安装淘宝镜像cnpm
【代码】安装淘宝镜像cnpm。
文章共271字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
npm使用国内淘宝镜像
一、通过命令配置
- 设置淘宝镜像源
npm config set registry https://registry.npm.taobao.org/
- 设置官方镜像源
npm config set registry https://registry.npmjs.org
- 查看镜像使用状态
npm config get registry
二、安装cnpm
- 安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 安装过程中安装失败
解决方案:
// 1.清除缓存
npm cache clean --force
// 2.切换新源
npm config set registry https://registry.npmmirror.com
// 3. 查看源是否设置成功
npm config get registry
// 4. 安装
到这里就可以正常使用npm命令安装需要的工具了。如( npm install -g cnpm )
- 查看cnvm
cnpm -v
- 注册模块镜像
# 注册模块镜像
npm set registry https://registry.npm.taobao.org
// node-gyp 编译依赖的 node 源码镜像
npm set disturl https://npm.taobao.org/dist
// 清空缓存
npm cache clean --force
// 安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
更多推荐
已为社区贡献2条内容
所有评论(0)