Installing Node.js
Start by visiting the main site for Node.js and click on the stable
download button this will initiate the download for a file name node-v5.9.0.tar.gz
, to install node run the following commands.
Now you must be asking why I did not just use sudo apt-get install nodejs
, well you see the packages for ubuntu or Debian tend not to get updated as frequently as you would like them to. This could cause errors in your programs. If you install it manually you will remove most of the headaches of having to deal with older versions of Node.js.
After the move command is complete it will install node at /usr/local/bin/node
and npm at /usr/local/bin/npm
and now you can double check if this directory is on your path variable by using echo $PATH
on your terminal, if it’s not there make sure you at to this file vim /etc/paths
and now you will have a working version of Node.js.
Once node is installed you can verify that node is setup correctly by checking what version of node is installed with the following command. Open up the terminal and use the following command.
node -v
Result
v5.9.0
Updating Node.js
If you would like to update Node.js you will have to either version of node that you want to keep on your machine or remove them. If you end up removing the versions of node then you just simply delete the binaries fund in the removing node section and then install the new version of node from a fresh download.
If you decide you want to work with different versions of Node.js, I would recommend you to section off each of the node versions in you /usr/local/bin/ and path variable set correctly.
Removing Node.js
To remove node from your operating system run the following command. This will delete the node binaries files. If your Linux distribution can not find node with the following command you will have to find out where you have installed node and remove it from that directory.
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More