last version of NodeJS install by apt-get

放肆的年华 提交于 2019-12-08 09:37:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!