This is my brief install instructions for getting started with NodeJS for a linux based OS.
The current recommended method to install node is via the version management tool ‘nvm’ (nvm.sh). This tool allows users to switch between multiple versions of the tool. Ironically, for a version manager you have to specify a version on download. However as it is all managed on a git repository, you just need to pull to get an existing installation up to date.
To get nvm you need may need some tools installed, depending on what OS you are using this can vary (Eg. Ubuntu use apt-get, for Centos use yum, for Mac tools such as Homebrew). For linux based systems, make sure you have wget or curl to download files from the internet via the terminal.
First download and run the install script using command:
1 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.NN.NN/install.sh | bash |
or1
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.NN.NN/install.sh | bash
Update v0.NN.NN to the version you wish to download. The latest version can be found at nvm.sh.
On running install.sh, you will be advised to restart the terminal to enable nvm or you can run command:1
. ~/.nvm/nvm.sh`
Once you have nvm installed and active, you should be able to use it to pick up versions of Node. Install a version of node using:
1 | nvm install <version> |
When node has been installed, you can check your node version using terminal command:
1 | node -v |
The node installation also installs npm (the package manager). You can confirm the version of this using the terminal command:1
npm -v
And viola, you should have a managed version of NodeJS installed with NPM.