欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

npm切换源

最编程 2024-03-14 10:28:07
...

国内npm镜像

淘宝npm镜像

搜索地址:http://npm.taobao.org/
registry地址:http://registry.npm.taobao.org/

cnpmjs镜像

搜索地址:http://cnpmjs.org/
registry地址:http://r.cnpmjs.org/

使用

有很多方法来配置npm的registry地址,下面根据不同情境列出几种比较常用的方法。以淘宝npm镜像举例:

临时使用
npm --registry https://registry.npm.taobao.org install express
持久使用
npm config set registry https://registry.npm.taobao.org

// 配置后可通过下面方式来验证是否成功

npm config get registry

// 或

npm info express
通过cnpm使用
npm install -g cnpm --registry=https://registry.npm.taobao.org

// 使用

cnpm install express

上一篇: npm 映像源管理

下一篇: npm换源