I have been working an hour for this.
Taken from their official documentation :
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
However, its never working for me. I have tried to clear the npm cache
, even uninstall it and run both command again. Its still not working. I keep getting version 0.10.25
I run :
grep -h ^deb /etc/apt/sources.list /etc/apt/sources.list.d/*
And this is what i get :
deb http://id.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://id.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb http://id.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty universe
deb http://id.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb http://id.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://id.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb http://id.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://id.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main
deb http://ppa.launchpad.net/cpug-devs/ppa/ubuntu saucy main
deb http://ppa.launchpad.net/cwchien/gradle/ubuntu saucy main
deb http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu trusty main
deb http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu trusty main
deb http://ppa.launchpad.net/dominik-stadler/subversion-1.8/ubuntu trusty main
deb http://linux.dropbox.com/ubuntu saucy main
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu saucy main
deb [arch=amd64,i386] http://repo.steampowered.com/steam/ precise steam
deb-src [arch=amd64,i386] http://repo.steampowered.com/steam/ precise steam
deb [arch=amd64,i386] http://repo.steampowered.com/steam/ precise steam
deb-src [arch=amd64,i386] http://repo.steampowered.com/steam/ precise steam
deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main
deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
It seems the nodejs
is not on the list.
What should i do? Please kindly help me
Below are the steps to install Node.js from source (OSX/linux)
NOTE - this installs Node.js which gives you both node as well as npm, they come together per release.
to start fresh remove prior node and npm installs as well as these :
download source from : http://nodejs.org/download/
You may/should issue all following cmds as yourself NOT root (sudo)
Pick one of these NODE_PARENT locations to define where node gets installed into :
./configure --prefix=${NODE_PARENT}
which puts it into dir defined by above --prefix
when you use syntax : npm install -g some_cool_module the -g for global installs it into dir $NODE_PATH and not your $PWD
IMPORTANT - put above three export xxx=yyy commands into your ~/.bashrc or some such to persist these environment variable changes
On subsequent updates to Nodejs, just update your ~/.bashrc with new release name in your NODE_PARENT env var , then source this ~/.bashrc and simply issue the configure/make/install as above
If you had a prior install of node you may want to copy over previously installed modules into new location :
or do fresh module installs using npm install -g xxxx
I finally used the unofficial/outdated way :
Taken from :
How can I update my nodeJS to the latest version?
However this make my
node -v
and mynodejs -v
have different version. Thenodejs -v
still return outdated version. I dont know if this have any effect yet.