Install latest nodejs version in ubuntu 14.04

There is an issue with node and npm update in Ubuntu14.04 LTS 64 bit OS. Since Google Chrome repository no longer provides 32-bit packages, 64-bit Ubuntu/Debian users will notice an error when updating the software sources, which looks as follows:

Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file) Some index files failed to download. They have been ignored, or old ones used instead.

So to fix this issue, the repository must be specifically set for 64-bit only. This can be done by the command

sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"

i,e You should set it for 64 bit only before installing node. So the exact procedure to install latest node and npm will be

sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -

sudo apt-get install -y nodejs

I had such an issue and got this solution from here. Hope this will help someone.


sudo apt-get install curl

For Node.js v4

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

For Node.js v5:

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v6:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v7:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js 8:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

https://nodejs.org/en/download/package-manager/


On Ubuntu 14.04.5 LTSthe easier way is

1 Install npm:

sudo apt-get install npm

  1. Install n

sudo npm install n -g

  1. Get latest version of node

sudo n latest

If you prefer to install a specific version of `node you can

2.1 List available node versions

n ls

2.2 and the install a specific version

sudo n 4.5.0


Here i am going to tell you how to install nodejs compile and install into your Linux Server.

Step 1-:

$ cd /opt/
$ wget https://nodejs.org/dist/v6.2.1/node-v6.2.1.tar.gz

Extract the tar.gz source code

$ tar -xvf node-*.tar.gz

Step 2-: Compile and install the nodejs.

$ cd node-v6.2.1
$ ./configure
$ make
$ sudo make install

Note-: If you found error “make command not found”

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install build-essential

$ gcc -v

$ make -v

Tags:

Ubuntu

Node.Js