Tuesday, February 7, 2017

How to install node.js on Linux Mint 18 Sarah

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
After that npm is also installed along with node.js. To check version of node write:
node -v
To check npm:
npm
To update npm to the latest version:
sudo npm install npm@latest -g
To fix npm permissions, first, create a folder in current user's home directory. Copy directory path to the newly created folder.
mkdir npm-global
cd npm-global
pwd
Set npm prefix setting to that folder.
npm config set prefix /home/current-user/npm-global
Add path /home/current-user/npm-global/bin to the system PATH settings. Open .profile file.
vi ~/.profile
Add following line to the file
export PATH=$PATH:/home/current-user/npm-global/bin
Reset settings by:
source ~/.profile

1 comment: