1

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?

Yigit Can
  • 361
  • 1
  • 3
  • 15

3 Answers3

4

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 (change 7.6.0 for whatever version you installed):

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

Check again Node.js version:

node -v

You can check this link.

Ave
  • 4,338
  • 4
  • 40
  • 67
0

You can use https://github.com/tj/n

sudo npm install -g n
sudo n latest
Dauren Akilbekov
  • 4,627
  • 2
  • 27
  • 32
  • sudo n latest results as following; `cp: cannot stat ‘/usr/local/n/versions/node//bin’: No such file or directory cp: cannot stat ‘/usr/local/n/versions/node//lib’: No such file or directory cp: cannot stat ‘/usr/local/n/versions/node//include’: No such file or directory cp: cannot stat ‘/usr/local/n/versions/node//share’: No such file or directory ` – Yigit Can Mar 31 '16 at 07:42
  • Try to install openssl, sudo apt-get install openssl – Dauren Akilbekov Mar 31 '16 at 08:42
  • I have openssl it's version is: OpenSSL 1.0.2d 9 Jul 2015 – Yigit Can Mar 31 '16 at 08:50
0

Are you in proxy environment? If so, please use "sudo -E" instead of "sudo".

$ sudo n stable --> NG
$ sudo -E n stable --> Maybe OK... (I hope so.)
tomo
  • 1