我在Ubuntu 10.10上运行Node.js v0.5.9-pre版本。
我希望使用v0.5.0-pre版本。
如何回滚到节点的旧版本?
我在Ubuntu 10.10上运行Node.js v0.5.9-pre版本。
我希望使用v0.5.0-pre版本。
如何回滚到节点的旧版本?
当前回答
nvmw已不再维护,但我找到了另一个似乎是最新的源代码(截至1/4/17)。
nvm-windows
它的工作原理。允许我降级到6.3.1
其他回答
我发现最简单的方法就是使用nodejs.org网站:
访问https://nodejs.org/en/download/releases/ 找到你想要的版本,然后点击下载 在MAC上单击.pkg可执行文件,并按照安装说明(不确定windows下正确的可执行文件是什么) 现在您已经在所需的节点版本上了
NIX (Linux, OS X, ...)
使用n,一个非常简单的Node版本管理器,可以通过npm安装。
假设你想要Node.js v0.10。x来构建Atom。
npm install -g n # Install n globally
n 0.10.33 # Install and use v0.10.33
Usage:
n # Output versions installed
n latest # Install or activate the latest node release
n stable # Install or activate the latest stable node release
n <version> # Install node <version>
n use <version> [args ...] # Execute node <version> with [args ...]
n bin <version> # Output bin path for <version>
n rm <version ...> # Remove the given version(s)
n --latest # Output the latest node version available
n --stable # Output the latest stable node version available
n ls # Output the versions of node available
窗户
使用nvm- Windows,它类似于nvm,但适用于Windows。下载并运行安装程序,然后:
nvm install v0.10.33 # Install v0.10.33
nvm use v0.10.33 # Use v0.10.33
Usage:
nvm install [version] # Download and install [version]
nvm uninstall [version] # Uninstall [version]
nvm use [version] # Switch to use [version]
nvm list # List installed versions
现在v0.5.0-pre已经走到了生命的尽头。我们可以使用npx来使用node的任何稳定的旧版本。例如,最早的稳定版本是4.9.0。
npx -p node@4.9.0 -- node -v
如果你已经安装了你想要的节点版本,但似乎无法切换到它,试试这个:
nvm use --delete-prefix <version>. npm shows the lates version installed but can't switch to it. If so, this is the output you will see: You need to run "nvm install v16.2.0 Then run:nvm install <type the version you wish to use here>Your output should look like this: Downloading and installing node v16.2.0... Downloading https://nodejs.org/dist/v16.2.0/node-v16.2.0-linux-x64.tar.xz... ####################################################################### 100.0% Computing checksum with sha256sum Checksums matched! Now using node v16.2.0 (npm v7.13.0) Creating default alias: default -> v16.2.0 You are done! You can see the latest version by running: node -v
为此,您需要安装NVM。
对于Mac
使用下面的命令编辑.bash_profile。
nano .bash_profile
并将以下行添加到.bash_profile
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
保存它。退出终端并检查魔法。
然后使用下面的命令安装所需的版本。
nvm install v14.18.0
如果您想检查系统上已安装的节点版本。使用下面的命令。
nvm ls
如果您想从已安装的节点版本中使用特定版本。使用以下命令
nvm use 12.14.4