跳转到主内容
趣航编程网 - 趣学编程,启航技术之路!

npm使用国内淘宝镜像的两种方法

目录

一、通过命令配置

二、通过使用cnpm安装

一、通过命令配置

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

解决安装卡顿或无法安装:

# 注册模块镜像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到此这篇关于npm使用国内淘宝镜像的两种方法的文章就介绍到这了,更多相关npm 国内淘宝镜像内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:使用淘宝镜像cnpm安装Vue.js的图文教程npm配置国内镜像资源+淘宝镜像的方法详解npm 配置项registry修改为淘宝镜像npm淘宝镜像修改讲解npm安装淘宝镜像报错问题解决(npm install -g cnpm) npm淘宝镜像过期解决办法

相关文章