问题
Debian Linux (Debian Stable, UBUNTU LTS, etc.) and others use apt-get as good and reliable installer tool. I need to use only apt-get... The problem is that I do the simple
sudo apt-get install nodejs
but as result I have nodejs --version (or node --version)
0.10.41
(!) It is not the today's most updated stable Node.JS version,
5.2.0
I also try node -p process.versions.v8 that results in
3.14.5.9
so, also is very less than 5.2.
NOTES
I am using UBUNTU 14 LTS.... And try a workaround but not works,
sudo apt-get remove --purge nodejs
sudo apt-get remove --purge node #enforce any lapse
And, as this suggestion
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
not works, some results.
回答1:
When installing from nodesource, you need to specify which version you want to install.
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_iojs_3.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_iojs_2.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_iojs_1.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_0.10 | sudo -E bash -
Followed by
sudo apt-get install -y nodejs (or sudo apt-get install -y iojs for iojs)
When using the url without any version (as you did), it seems you get node 0.10 for some reason.
You'll find more information here.
来源:https://stackoverflow.com/questions/34243112/last-version-of-nodejs-install-by-apt-get