node.js Windows 上的节点版本管理器 (NVM)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25654234/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 17:51:00  来源:igfitidea点击:

Node Version Manager (NVM) on Windows

node.jsnpmnvm

提问by Alexander Mills

I am trying to downgrade my version of node

我正在尝试降级我的节点版本

I ran:

我跑了:

npm install nvm

and I exported the bin folder to my Windows path variable,

我将 bin 文件夹导出到我的 Windows 路径变量,

C:\Program Files (x86)\nodejs\node_modules\npm\bin

but I still get:

但我仍然得到:

'nvm' is not recognized as a an internal or external command.

'nvm' 未被识别为内部或外部命令。

Should I be adding another path to my path variable?

我应该为我的路径变量添加另一个路径吗?

回答by Corey

nvm was designed for Linux. nvmw, which is completely different broke around node v0.10.30. Try NVM for Windows.

nvm 是为 Linux 设计的。nvmw,在节点 v0.10.30 周围完全不同。试试NVM for Windows

回答by Ritu Gupta

Nvm can be used to manager various node version :

Nvm 可用于管理各种节点版本:

  • Step1: Download nvm
  • Step2: Choose nvm-setup.zip
  • Step3: Unzip & click on installer.
  • Step4: Check if nvm properly installed, In new command prompt type nvm
  • Step5: Install node js using nvm : nvm install <version> : The version can be a node.js version or "latest" for the latest stable version
  • Step6: check node version - npm -v
  • Step7(Optional)If you want to install another version of node js - Use STEP 5 with different version.

  • Step8: Check list node js version - nvm list

  • Step9: If you want to use specific node version do - nvm use <version>
  • 第一步:下载nvm
  • 步骤 2:选择 nvm-setup.zip
  • 第三步:解压并点击安装程序。
  • 步骤 4:检查 nvm 是否正确安装,在新的命令提示符中键入 nvm
  • Step5:使用 nvm 安装 node js: nvm install <version> : The version can be a node.js version or "latest" for the latest stable version
  • Step6:检查节点版本 - npm -v
  • Step7(可选)如果你想安装其他版本的node js - 使用不同版本的STEP 5。

  • Step8:检查列表节点js版本- nvm list

  • 步骤 9:如果您想使用特定的节点版本,请执行 - nvm use <version>

回答by Shrinivas Kalangutkar

NVM Installation & usage on Windows

NVM 在 Windows 上的安装和使用

Below are the steps for NVM Installation on Windows:

以下是在 Windows 上安装 NVM 的步骤:

NVM stands for node version manager, which will help to switch between nodeversions while also allowing to work with multiple npmversions.

NVM 代表节点版本管理器,这将有助于在节点版本之间切换,同时还允许使用多个npm版本。

  • Install nvmsetup.
  • Use command nvm listto check list of installed nodeversions.
  • Example: Type nvm use 6.9.3to switch versions.
  • 安装nvm设置。
  • 使用命令nvm list检查已安装的节点版本列表。
  • 示例:键入nvm use 6.9.3以切换版本。

For more info

欲了解更多信息

回答by Joel Chen

I created a universal nvm that works on both Unix (bash) and Windows, base on another simple nvm.

我基于另一个简单的 nvm 创建了一个适用于 Unix (bash) 和 Windows 的通用 nvm。

It doesn't need admin on Windows, but requires PowerShell 4+ and the right to execute scripts.

它在 Windows 上不需要管理员,但需要 PowerShell 4+ 和执行脚本的权利。

https://www.npmjs.com/package/@jchip/nvm#installation

https://www.npmjs.com/package/@jchip/nvm#installation

回答by nilakantha singh deo

The first thing that we need to do is install NVM.

我们需要做的第一件事是安装 NVM。

  1. Uninstall existing version of node since we won't be using it anymore
  2. Delete any existing nodejs installation directories. e.g. “C:\Program Files\nodejs”) that might remain. NVM's generated symlink will not overwrite an existing (even empty) installation directory.
  3. Delete the npm install directory at C:\Users[Your User]\AppData\Roaming\npm We are now ready to install nvm. Download the installer from https://github.com/coreybutler/nvm/releases
  1. 卸载现有版本的节点,因为我们将不再使用它
  2. 删除任何现有的 nodejs 安装目录。例如“C:\Program Files\nodejs”)可能会保留。NVM 生成的符号链接不会覆盖现有(甚至是空的)安装目录。
  3. 删除 C:\Users[Your User]\AppData\Roaming\npm 中的 npm 安装目录 我们现在准备安装 nvm。从https://github.com/coreybutler/nvm/releases下载安装程序

To upgrade,run the new installer. It will safely overwrite the files it needs to update without touching your node.js installations. Make sure you use the same installation and symlink folder. If you originally installed to the default locations, you just need to click “next” on each window until it finishes.

要升级,请运行新安装程序。它将安全地覆盖它需要更新的文件,而不会触及您的 node.js 安装。确保使用相同的安装和符号链接文件夹。如果您最初安装到默认位置,则只需在每个窗口上单击“下一步”,直到完成。

CreditsDirectly copied from : https://digitaldrummerj.me/windows-running-multiple-versions-of-node/

积分直接复制自:https: //digitaldrummerj.me/windows-running-multiple-versions-of-node/

回答by user3834928

First off, I use nvm on linux machine.

首先,我在 linux 机器上使用 nvm。

When looking at the documentation for nvm at https://www.npmjs.org/package/nvm, it recommendations that you install nvm globally using the -gswitch.

https://www.npmjs.org/package/nvm查看 nvm 的文档时,它建议您使用-g开关全局安装 nvm 。

npm install -g nvm

Also there is a . in the path variable that they recommend.

还有一个 . 在他们推荐的路径变量中。

export PATH=./node_modules/.bin:$PATH

so maybe your path should be

所以也许你的路径应该是

C:\Program Files (x86)\nodejs\node_modules\npm\.bin

回答by Claudiu

As an node manager alternative you can use Voltafrom LinkedIn.

作为节点管理器的替代方案,您可以使用来自 LinkedIn 的Volta

回答by fahimeh ahmadi

The first thing that we need to do is install NVM. website : https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows

我们需要做的第一件事是安装 NVM。网站:https: //docs.microsoft.com/en-us/windows/nodejs/setup-on-windows