我在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版本。
如何回滚到节点的旧版本?
当前回答
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
其他回答
我的节点版本是6.4.0。
由于我需要旧版本的6.3.0,我刚刚在我的系统中重新安装了6.3.0版本。节点版本自动降级。
因此,为了降低节点版本, 只需要安装旧版本的node js。它会自动从更高的版本降级。
我在osx试过。这招很管用。
如果你已经安装了你想要的节点版本,但似乎无法切换到它,试试这个:
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
现在v0.5.0-pre已经走到了生命的尽头。我们可以使用npx来使用node的任何稳定的旧版本。例如,最早的稳定版本是4.9.0。
npx -p node@4.9.0 -- node -v
一种方法是使用NVM,即节点版本管理器。
使用以下命令获取nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
你可以在https://github.com/creationix/nvm上找到它
它允许您轻松地安装和管理多个版本的node。下面是帮助中的一个片段:
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
我发现最简单的方法就是使用nodejs.org网站:
访问https://nodejs.org/en/download/releases/ 找到你想要的版本,然后点击下载 在MAC上单击.pkg可执行文件,并按照安装说明(不确定windows下正确的可执行文件是什么) 现在您已经在所需的节点版本上了