Node notes
npm
Node package manager is installed as part of the node installation.
- Install a package locally:
npm install lodash
Package is installed into the local node_modules directory.
- Install a package globally:
npm install -g lodash
Package is installed into the global root.
- View global root (where global packages are installed):
npm root -g
npx
Npx is an npm package runner. It will search for packages in your local and the global registry and run them if found. If the package is not found it will download and install it first.
npx npm-remote-ls bower
yarn
Is alternative package management tool to npm it was created (2016) to address some issues with npm at that time. Namely it:
- Install packages in parallel
- Creates a lock file.
N. These issues have mainly been addressed within npm now.
nvm
Node version manager allows you to install and upgrade node
- Install the most recent long term stable:
nvm install –lts
- List the versions available:
nvm ls-remote
- Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash