1、先下载nvm安装包
https://github.com/coreybutler/nvm-windows/releases
下载nvm-setup.zip这个就能傻瓜安装
nvm-setup.zip
控制台输入nvm后出现如下代码表示nvm安装成功
Running version 1.1.9.
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 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.
然后安装node,如果安装nvm之前有node版本最好先卸载后安装nvm。
比如安装17.0.0这个版本的node,输入以下
nvm install 17.0.0
出现如下就安装成功了
Downloading node.js version 17.0.0 (64-bit)...
Extracting...
Complete
Installation complete. If you want to use this version, type
nvm use 17.0.0
查看当前所有node版本
nvm list
下边就是我安装的node版本
17.0.0
16.14.0
* 12.16.2 (Currently using 64-bit executable)
11.15.0
10.16.0
9.11.2
8.16.0
关于镜像:
在这个路径下:C:\Users\Administrator\AppData\Roaming\nvm
找到settings.txt,
打开输入:
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
然后保存
git查看当前镜像源:
npm get registry
淘宝源:https://registry.npm.taobao.org
git切换源:
npm config set registry XXX