Saturday, March 24, 2018

How to install Node.js & npm on linux

To install npm in linux you can use terminal
 $ sudo apt-get install npm 

To install node.js you can use following commands

Node.js 8

curl -sL https://deb.nodesource.com/setup_8.x 
sudo -E bash - 
sudo apt-get install -y nodejs 

Node.js 9
curl -sL https://deb.nodesource.com/setup_9.x 
sudo -E bash - 
sudo apt-get install -y nodejs 

Update Node.js
sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable