Showing posts with label Code. Show all posts
Showing posts with label Code. Show all posts

Sunday, April 26, 2020

Install Node.js from binaries on your Linux system


Of course, you can install Node from installer scripts or use the repository version from your distribution. But if you are like me and want to have full control of what version you want to use for your projects, the binary install is the way to go.
Alternatively, you could use the nvm (node version manager) to achieve the same.
But I like to keep things simple and clear. 



Step 1:

Download the version you want to use from the node website.
At the time of this writing, the version latest version file: node-v14.0.0-linux-x64.tar.xz

Step 2:

Extract the tar-file to the location of your liking. ( ~/node-v14.0.0)

Step 3:

Edit either your .bashrc or .profile file to add the path to your node-folder.
I prefer to use my .bashrc file as I add many other handy things in there, and distribute it to all my systems


edit ~/.bashrc 

and add the following lines

# ---------------------
# Node-js settings:
# ---------------------
export NODEJS_HOME=~/node-v14.0.0
export PATH=$PATH:$NODEJS_HOME/bin


Step 4:

Refresh .bashrc or .profile or simply exit terminal and open again

Step 5:

Test the version of node and npm

~$ node -v 
> v14.0.0

~$ npm -v 
> v6.14.4