Yigit Can Yigit Can - 1 month ago 4
Node.js Question

Cannot update the version of nodejs ubuntu 15.01

I don't understand why I cannot achieve even if I write exactly the same lines in the website of nodejs
nodejs documentation says that

for Alternatively, for Node.js v5:

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


When I follow the instructions it says;

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 218 not upgraded.
Need to get 0 B/684 kB of archives.
After this operation, 3.116 kB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 175307 files and directories currently installed.)
Preparing to unpack .../nodejs_0.10.25~dfsg2-2ubuntu1_amd64.deb ...
Unpacking nodejs (0.10.25~dfsg2-2ubuntu1) ...
Processing triggers for doc-base (0.10.6) ...
Processing 1 added doc-base file...
Processing triggers for man-db (2.7.4-1) ...
Setting up nodejs (0.10.25~dfsg2-2ubuntu1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode


As you can see it says;

Preparing to unpack .../nodejs_0.10.25~dfsg2-2ubuntu1_amd64.deb ...


How can I install the latest version?

Answer

Check current Node.js version:

node -v

Clean Cache Forcefully:

sudo npm cache clean -f

Install n Module:

sudo npm install -g n

Install latest Node.js:

sudo n stable

Setup binary link:

sudo ln -sf /usr/local/n/versions/node/6.8.0/bin/node /usr/bin/node

Check again Node.js version:

node -v

You can check this link:

Comments