Installing Node
Step-by-step guide to install Node.js using NVM, the tool that lets you manage multiple Node versions on the same machine.
Requirements
Operating System | Version |
---|---|
Debian | 10 |
Installing NVM
Optional: clean up any previous NVM installation and cached folders.
rm -rf $NVM_DIR ~/.npm ~/.bower
Download and install the latest release from the project page at https://github.com/nvm-sh/nvm. Replace
v0.35.3
with the current tag if it has changed.curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Reload your shell configuration so the
nvm
command becomes available.source ~/.bashrc
Confirm that the installation worked.
nvm --version
0.35.3
Installing Node
Check the LTS version available at https://nodejs.org or run nvm ls-remote --lts
, then replace 12.17.0
with the release you want to install.
nvm install 12.17.0
When the download completes, verify that Node is ready to use.
node --version
v12.17.0
Useful NVM Commands
Install Node 8.
nvm install 8
Downloading and installing node v8.17.0...
Downloading https://nodejs.org/dist/v8.17.0/node-v8.17.0-linux-x64.tar.xz...
##################################################################### 100,0%
Computing checksum with sha256sum
Checksums matched!
Now using node v8.17.0 (npm v6.13.4)
List the Node versions currently installed.
nvm list
-> v8.17.0
v12.17.0
default -> 12 (-> v12.17.0)
...
Activate Node 8 for the current shell session.
nvm use 8
Set Node 8 as the default choice for new shells.
nvm alias default 8
Uninstall Node 12.17.0.
nvm uninstall 12.17.0
Updating NPM
NPM ships with Node.js, but the CLI evolves quickly, so it's worth updating it after you install Node.
Install the latest stable release.
npm install -g npm@latest
Check the version.
npm --version
6.14.5
Installing Packages
The following command scaffolds a package.json
file that tracks a project's dependencies.
npm init
Local install (updates package.json
).
npm install --save express
npm install --save-dev eslint
Global install.
npm install -g @angular/cli
References
Published: May 23, 2020