How to Install node.js on Windows:
You can install node.js for windows from Node.js website as they had provided the installer there. You need to run the .msi installer that is downloaded.
Then Restart your computer as you won’t be able to run Node.js until you restart your computer.
How to Install node.js on Linux(Ubuntu):
In order to install node.js, open the Command Prompt Terminal (Ctrl+Alt+t) and follow these steps:
First, you need to get updates from the servers so run this command on your shell:
:~$ sudo apt-get update
2. Then install node.js using following command:
:~$ sudo apt-get install nodejs
3. After this you will also need to install npm (node package manager) that will allow you to
easily install modules and packages to use with node.js.
:~$ sudo apt-get install npm
Version:
You can check version of node.js or can test whether it is installed or not by using this command node -v. It will give you version of node.js that you installed and to know the version of npm use this npm -v.
NVM (Node Version Manager) is the best way to update node. It’s a bash script that lets you download different versions of node.
Use curl to install or update nvm:
:~$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
To verify that nvm has been installed type this:
:~$ command -v nvm
It will output nvm if installation was successful. Now after this you can install the latest release of node using this:
nvm install node
Remove nodejs
By using this you can remove nodejs:
:~$ sudo apt-get --purge remove nodejs
At last run this:
:~$ sudo apt-get update