安装不同版本的 NodeJS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8455290/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install different versions of NodeJS
提问by Xitrum
采纳答案by alessioalex
回答by Marco
I use nave. https://github.com/isaacs/nave
我用天真。https://github.com/isaacs/nave
> npm install -g nave
> nave use 0.4.12 # starts a subshell with 0.4.12 at the head of the path
> node --version
v0.4.12
> exit # go back to the original shell
> nave use 0.6.5
> node --version
v0.6.5
> nave usemain
Note that the first time you need a version, it will be downloaded and compiled for you.
请注意,您第一次需要一个版本时,它会为您下载和编译。
回答by Javarome
If you need something simple, the nutility is just for you.
如果您需要一些简单的东西,该n实用程序正适合您。
Install it (use sudoprefix in commands if required):
安装它(sudo如果需要,在命令中使用前缀):
npm -g install n
then :
然后 :
npm cache clean -f
(don't be scared about the warning)
(不要害怕警告)
then just ask nto (download if required and) use the version you specify. For instance:
然后只需要求n(如果需要,请下载并)使用您指定的版本。例如:
n 0.11.13
Et voilà !
等等!
Should you install multiple versions, you'll be able to switch between them. See the n pagefor details.
如果您安装多个版本,您将能够在它们之间切换。有关详细信息,请参阅第n 页。
回答by Venkatesh
You can follow simple approach here
你可以在这里遵循简单的方法
step1:
第1步:
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash
step2:
第2步:
$ source ~/.profile
step3:list the latest versions of node
step3:列出最新版本的node
$ nvm ls-remote
step4:
第四步:
$ nvm install 7.10.0
step5:Create alias as default for node version
步骤 5:为节点版本创建别名作为默认值
$ nvm alias default 7.10.0
step6:
第六步:
$node --version
that's it.
就是这样。
回答by hawbsl
Windows users check out nvmwhere.
Windows 用户在nvmw此处查看。
You can go quite a long way down trying to install some of the other versions listed before realising there's no Windows support.
在意识到没有 Windows 支持之前,您可以尝试安装列出的一些其他版本。
e.g. on the page for nave
例如在页面上 nave
It will probably never work on Windows, or other systems lack a native Bourne Again Shell. Sorry.
它可能永远不会在 Windows 上运行,或者其他系统缺少本机 Bourne Again Shell。对不起。

