如何设置淘宝镜像?

针对国外网速影响,文章提供了将npm配置为使用淘宝镜像的步骤,包括设置registry和安装cnpm。同时,也介绍了yarn的安装方法,以及如何使用yarn和npm安装模块包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在国外,受网速影响比较大
https://registry.npmjs.org/


1.配置 npm 为淘宝镜像
npm config set registry https://registry.npm.taobao.org


2.安装 cnpm 为淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org

如果还想使用原来的国外的镜像
https://registry.npmjs.org/
-----------------------------------------------------------------------------------


yarn 
安装 yarn
npm i yarn -g  /   cpnm i yarn -g

查看版本
yarn -v 如果能打印出版本号,说明安装成功


下载模块包
npm i xxx / cnpm i xxx / yarn add xxx
 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值