NVM Linux Windows nodejs 版本管理工具
nodejs 版本管理工具
nvm 在 Windows 安装 直达:下载 setup.zip 解压直接安装
把全局安装的 nodejs 卸载
如果下载 nvm 1.18版本,目前或需要使用以管理员身份运行
使用
直接命令行 nvm 有说明,简单明了
设置 nvm 下载 nodejs 和 npm 的镜像
PS C:\WINDOWS\system32> nvm Running version 1.1.8. Usage: nvm arch : Show if node is running in 32 or 64 bit mode. nvm current : Display active version. nvm install <version> [arch] : The version can be a specific version, "latest" for the latest current version, or "lts" for the most recent LTS version. Optionally specify whether to install the 32 or 64 bit version (defaults to system arch). Set [arch] to "all" to install 32 AND 64 bit versions. Add --insecure to the end of this command to bypass SSL validation of the remote download server. nvm list [available] : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls. nvm on : Enable node.js version management. nvm off : Disable node.js version management. nvm proxy [url] : Set a proxy to use for downloads. Leave [url] blank to see the current proxy. Set [url] to "none" to remove the proxy. nvm node_mirror [url] : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url. nvm npm_mirror [url] : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url. nvm uninstall <version> : The version must be a specific version. nvm use [version] [arch] : Switch to use the specified version. Optionally use "latest", "lts", or "newest". "newest" is the latest installed version. Optionally specify 32/64bit architecture. nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode. nvm root [path] : Set the directory where nvm should store different versions of node.js. If <path> is not set, the current root will be displayed. nvm version : Displays the current running version of nvm for Windows. Aliased as v. PS C:\WINDOWS\system32> nvm node_mirror http://npm.taobao.org/mirrors/node/ PS C:\WINDOWS\system32> nvm npm_mirror http://npm.taobao.org/mirrors/npm/ PS C:\WINDOWS\system32>
nvm node_mirror http://npm.taobao.org/mirrors/node/
nvm npm_mirror http://npm.taobao.org/mirrors/npm/
镜像更新为
nvm node_mirror https://npmmirror.com/mirrors/node/
nvm npm_mirror https://npmmirror.com/mirrors/npm/
nvm use [version]命令使用报 exit status
类似的 exit status 1 或 5 ,都是以管理员身份运行 PowerShell 解决。
use 成功过后,
nvm ls
出现的版本列表里面的当前版本前面会有一个 星号
* 16.18.0 10.9.0
再切换了 nodejs 版本过后,需要再设置一下 npm 的镜像
npm config set registry https://registry.npmmirror.com/