Brainstorm's snippets (1/262)

  How to Install and upgrade Node.js and NPM on Ubuntu

Installation (on Ubuntu 18)

sudo apt-get install nodejs
sudo apt-get install npm

Results:

$ which node
/usr/bin/node
$ which nodejs
/usr/bin/nodejs
$ which npm
/usr/bin/npm
$ node -v
v8.10.0
$ nodejs -v
v8.10.0
$ npm -v
3.5.2

Upgrade (on Ubuntu 18)

npm install -g n
n stable

Results:

$ which node
/usr/local/bin/node
$ which nodejs
/usr/bin/nodejs
$ which npm
/usr/local/bin/npm
$ node -v
v14.16.0
$ nodejs -v
v8.10.0
$ npm -v
6.14.11