[英]Install different versions of NodeJS
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.请注意,当您第一次需要版本时,它将为您下载和编译。
If you need something simple, the n
utility is just for you.如果您需要一些简单的东西, n
实用程序就是为您准备的。
Install it (use sudo
prefix in commands if required):安装它(如果需要,在命令中使用sudo
前缀):
npm -g install n
then :然后 :
npm cache clean -f
(don't be scared about the warning) (不要害怕警告)
then just ask n
to (download if required and) use the version you specify.然后只要求n
(如果需要下载并)使用您指定的版本。 For instance:例如:
n 0.11.13
Et voilà !等等瞧!
Should you install multiple versions, you'll be able to switch between them.如果您安装多个版本,您将能够在它们之间切换。 See the n page for details.有关详细信息,请参阅第n 页。
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:第4步:
$ nvm install 7.10.0
step5: Create alias as default for node version step5:为节点版本创建默认别名
$ nvm alias default 7.10.0
step6:第6步:
$node --version
that's it.而已。
Windows users check out nvmw
here . 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 之前,您可能会尝试安装列出的其他一些版本。
eg on the page for nave
例如在nave
的页面上
It will probably never work on Windows, or other systems lack a native Bourne Again Shell.它可能永远无法在 Windows 上运行,或者其他系统缺少本机 Bourne Again Shell。 Sorry.对不起。
最好的选择是节点版本管理器NVM非常易于安装,您可以使用简单的nvm use
命令从一个版本更改为另一个版本。
You can use NVM - Node Version Manager, Supports both Windows and Mac.您可以使用 NVM - 节点版本管理器,同时支持 Windows 和 Mac。
It has all the instructions of how to install and use it.它包含有关如何安装和使用它的所有说明。
https://github.com/nvm-sh/nvm https://github.com/nvm-sh/nvm
These will be independent installs so you will need to install packages in each versions.这些将是独立安装,因此您需要在每个版本中安装软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.