NodeJS笔记
使用淘宝镜像
配置
shell
npm config set registry https://registry.npmmirror.com/验证
shell
npm config get registry如果返回 https://registry.npmmirror.com// ,说明镜像配置成功。
修改全局配置
shell
npm config set prefix "D:\Soft\nodejs\node_global"
npm config set cache "D:\Soft\nodejs\node_cache"安装cnpm
安装
shell
npm install -g cnpm --registry=https://registry.npmmirror.com/建立软连接
shell
ln -s /home/soft/nodejs/bin/cnpm /usr/local/bin/cnpm使用cnpm
shell
cnpm install xxx查看全局安装列表
shell
➜ ~ npm list -g --depth=0
/Users/xxx/.nvm/versions/node/v19.8.1/lib
├── cnpm@9.0.1
├── corepack@0.17.0
├── http-server@14.1.1
├── npkill@0.11.1
├── npm@9.6.5
├── pnpm@8.7.6
└── yarn@1.22.19