windows平台使用nvm-windows管理多版本nodejs(npm)

nvm-windows 可以在windows平台上实现类似nvm的多版本nodejs的管理;

下载安装

github下载最新版nvm-windows安装包:https://github.com/coreybutler/nvm-windows

默认安装路径
C:\Users\yourUsername\AppData\Roaming\nvm
nodejs安装路径
D:\Program Files\nodejs

如果系统中已经安装了某版本node,会多次提示你要不要使用nvm来管理,一律点

换国内源

找到文件C:\Users\yourUsername\AppData\Roaming\nvm\settings.txt添加两行:

node_mirror: https://registry.npmmirror.com/mirrors/node/
npm_mirror: https://registry.npmmirror.com/mirrors/npm/

常用命令

# Display active version
nvm version
# Show if node is running in 32 or 64 bit mode
nvm arch
# List the node.js installations. Type "available" at the end to see what can be installed.
nvm list
# Display active version
nvm current
# The version can be a specific version, "latest" for the latest current version, or "lts" for the most recent LTS version.
nvm install <version>
# Switch to use the specified version.
nvm use <version>
# The version must be a specific version.
nvm uninstall <version>

npm切换国内源

npm config set registry https://registry.npmmirror.com

注意:

在使用nvm use命令时需要使用管理员运行shell(powershell 或者 cmd等),不然就会出现exit status 5 和 exit status 1的错误。

windows平台使用nvm-windows管理多版本nodejs(npm)

原文链接:https://beltxman.com/3789.html,若无特殊说明本站内容为 行星带 原创,未经同意禁止转载。

发表评论

您的电子邮箱地址不会被公开。

Scroll to top