进入node官网下载安装包 安装选择下面选项
windows 用户请下载安装nvm-windows
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 show a list of versions available for download.
nvm on: Enable node.js version management.
nvm off: Disable node.js version management (does not uninstall anything).
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 node_mirror <node_mirror_url>: Set the node mirror.People in China can use https://npmmirror.com/mirrors/node/
nvm npm_mirror <npm_mirror_url>: Set the npm mirror.People in China can use https://npmmirror.com/mirrors/npm/
如果改源下载速度还是很慢的话可以尝试一下手动下载:[下载](https://blog.csdn.net/DW14687/article/details/122957949)
# 1.安装n
curl -L https://git.io/n-install | bash
# 2.安装node
n 14
n lts
D:\node_package\npm_cache
D:\node_package\yarn
D:\node_package\yarn_cache
2. 更改npm 和 yarn 的配置
npm config set prefix "D:\node_package\npm" npm config set cache "D:\node_package\npm_cache" npm config set registry https://registry.npm.taobao.org/
yarn config set prefix "D:\node_package\yarn" yarn config set global-folder "D:\node_package\yarn" yarn config set cache-folder "D:\node_package\yarn_cache" yarn config set registry https://registry.npm.taobao.org/
3. 查看配置
npm config list
yarn config list ```