淘宝 NPM 镜像站(http://npm.taobao.org)已更换域名,新域名:
-
Web 站点:https://npmmirror.com
-
Registry Endpoint:https://registry.npmmirror.com
详见:
为了方便切换nodejs版本,可以使用nvm工具,安装方法参考:
window下安装并使用nvm(含卸载node、卸载nvm、全局安装npm)_window安装nvm-CSDN博客
nvm新淘宝镜像配置settings.txt:
bash
root: D:\env\nvm
path: D:\env\nodejs
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/
注意下载nvm是不要下载nvm-update.zip,nvm-update.exe运行时没有安装界面。
nvm安装包下载地址:
https://github.com/coreybutler/nvm-windows/releases
为不同版本的nodejs安装配置统一的npm:
bash
PS C:\Users\admin> npm config set prefix "D:\env\nvm\npm"
PS C:\Users\admin> npm install npm -g --registry=https://registry.npmmirror.com
D:\env\nvm\npm\npm -> D:\env\nvm\npm\node_modules\npm\bin\npm-cli.js
D:\env\nvm\npm\npx -> D:\env\nvm\npm\node_modules\npm\bin\npx-cli.js
npm WARN notsup Unsupported engine for npm@10.2.2: wanted: {"node":"^18.17.0 || >=20.5.0"} (current: {"node":"14.17.6","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: npm@10.2.2
+ npm@10.2.2
added 227 packages from 112 contributors in 22.403s
注意:还需要在用户变量中添加 NPM_HOME
= D:\env\nvm\npm
,path中添加%NPM_HOME%
。这里需要注意的是,%NPM_HOME%
要添加在%NVM_SYMLINK%
之前,避免npm访问到的是nodejs中自带的npm包管理工具。