npm配置淘宝镜像方法
node-gyp 编译依赖的 node 源码镜像。",说明配置的是淘宝镜像;",说明配置的是官方镜像。
文章共295字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
一、通过命令配置
1、设置淘宝镜像源
npm config set registry https://registry.npm.taobao.org/
2、设置官方镜像源
npm config set registry https://registry.npmjs.org
3、查看镜像使用状态:
npm config get registry
若返回 "https://registry.npm.taobao.org/",说明配置的是淘宝镜像;
如果返回 "https://registry.npmjs.org/",说明配置的是官方镜像。
二、通过使用cnpm安装
1、安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
三、解决安装卡顿或无法安装,设置cnpm
1、安装cnpm
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、使用cnpm
cnpm install xxx
更多推荐
已为社区贡献1条内容
所有评论(0)