ashok.emit('tech')
Jun 1, 2017 • 1 min read

Installing Node.js 8+ manually in Ubuntu

Few days back Node.js 8.0.0 was released. Without any ado, lets get started with the process of installing Node.js 8.0.0 in Ubuntu/Xubuntu.

Get the .tgz

Simply go to the official website of Node.js or click here to download th latest version of Node.js. After you downloaded the package, extract it using the command:

tar -xf name_of_package

Rename the folder just made after extraction of the package to nodejs. Command is this:

mv name_of_package nodejs

Copy the folder ‘nodejs‘ inside the ‘/bin‘ folder in root directory using the command:

sudo cp -r nodejs /bin

At this point, you need to add the Node.js binaries in the PATH variable so that they can be executed from anywhere.

There are two ways to do this. I am using the less popular way to keep things easy. What you have to do is that copy the files inside nodejs/bin to usr/local/bin. Using the command:

sudo cp /bin/nodejs/bin/* /usr/local/bin/

Okay all done

Check the version of Node.js and NPM using the following command:

node -v
npm -v

If you face any error while checking the version of npm, one like this

“Error: Cannot find module ‘../lib/utils/unsupported.js’“

Do the following :

sudo rm usr/local/bin/npm
cd ~/Downloads
cd nodejs/bin

Execute npm from inside the node binaries file to install latest version of NPM globally. Use the following command:

sudo ./npm install npm@latest -g

Finally, Done 😊

Now finally you can use the latest NPM v5+ and Node.js v8+.

Hope you find the above instructions helpful. You can mention issues, suggestions in comments below.

Post by: Ashok Dey Fullstack JavaScript engineer, crafting scalable backends!