首页 前端知识 npm使用国内淘宝镜像的方法(最新)

npm使用国内淘宝镜像的方法(最新)

2024-06-01 10:06:00 前端知识 前端哥 602 554 我要收藏

一、通过命令配置

1、设置淘宝镜像源

//旧
npm config set registry https://registry.npm.taobao.org/
//新
npm config set registry https://registry.npmmirror.com

旧域名将在 2022.06.30 号正式下线和停止 DNS 解析
在这里插入图片描述

2、设置官方镜像源

npm config set registry https://registry.npmjs.org

3、查看镜像使用状态:

npm config get registry

二、通过使用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
转载请注明出处或者链接地址:https://www.qianduange.cn//article/10427.html
标签
评论
发布的文章

npmjs官网(查询依赖包)

2024-06-07 00:06:56

npx使用及原理

2024-06-07 00:06:36

npm 包管理工具

2024-06-07 00:06:33

vue 思极地图开发

2024-06-07 00:06:28

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!