I installed nodejs on ubuntu from instructions given here
When I write node --version
in the terminal I see this :
-bash: /usr/sbin/node: No
Best way to install nodejs is through NVM (Node Version Manager)
Delete previous versions :
$ sudo apt-get purge node
$ sudo apt autoremove
Also delete all node_modules by $ sudo rm -rf node_modules
in the directory containing this folder.
Node & Nodejs are technically the same thing. Just the naming changed.
First Install or update nvm
to run as root
$ sudo su
Then
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash
OR
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash
Check nvm to path
$ source ~/.profile
$ nvm ls-remote
if you get error regarding the listing then install git.
$ sudo apt-get install git
Re-run :
$ nvm ls-remoteOR
$ sudo nvm ls-remote
$ nvm install version-you-require
Checking Version
# node --version
nvm use version-you-require
INFORMATION COURTESY :
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps