npm
Install
- Npm docs: Install
- Arch npm package
- Manjaro packages: npm
- Issue:
npm
10.1.0
package ignores thehttps_proxy
etc env vars./usr/lib/node_modules/corepack/shims/npm
from thenodejs
package does honor them. Waiting for npm 10.2.0 to be available from the ManjaroStable
repo.
Global Config / setup
npm config list
Global installation in homdir
mkdir ~/.npm/packages
npm config set prefix ~/.npm/packages
Show root dirs:
npm root -g
npm root
Show prefix dirs:
npm prefix
npm prefix -g
Install / Upgrade npm
npm install npm@latest -g
Installation paths:
- local:
~/node_modules/.bin/
- global:
~/.npm-global/bin/
Install npm modules locally, not as root
Resolving EACCES permissions errors when installing packages globally
npm install mermaid.cli
~/node_modules/.bin/mmdc -h
Install from Github
npm install LinuxBozo/jsonresume-theme-kendall#main
Upgrade module
npm update turndown --depth 3
Update package-lock.json
Update package-lock.json
after updating versions in package.json
:
npm update --save
Audit security vulnerabilities
npm audit
npm audit fix
npx
Introducing npx: an npm package runner
Yarn
Until this Debian ITP got resolved:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo tee /etc/apt/trusted.gpg.d/yarn.asc
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
Config at ~/.yarnrc