当前位置:网站首页>How to change npm to Taobao mirror [easy to understand]
How to change npm to Taobao mirror [easy to understand]
2022-07-31 18:23:00 【Full stack programmer webmaster】
大家好,又见面了,我是你们的朋友全栈君.
npm The method of changing to Taobao mirror
1、命令行临时使用指定镜像(淘宝)
npm --registry https://registry.npm.taobao.org install express
2、命令行永久更改使用指定镜像(淘宝)
npm config set registry https://registry.npm.taobao.org
以后 npm install express Specify is used by default(淘宝)镜像
3、通过npm配置文件直接修改,essence and2条一样,配置文件位置(windows环境)为C盘下的.npmrc文件(Baidu can easily find the file path),MAC没试过.The configuration file location can be found with the following command
npm config ls -l
4、使用淘宝 NPM 镜像(参考 http://www.runoob.com/nodejs/nodejs-npm.html)
命令行输入
npm install -g cnpm --registry=https://registry.npm.taobao.org
这样就可以使用 cnpm 命令来安装模块了: cnpm install express
查看目前使用的npm镜像的方法:
npm config get registry
5、Set the download address of a single package(以包electron,其镜像https://npm.taobao.org/mirrors/electron/为例,参考https://reactnative.cn/docs/debugging/)
打开.npmrc,Add the specified mirror for this package,截图如下
6、If you want to change the mirror source back to a foreign source, you can directly change it.npmrc文件直接删除,You can restore it directly from the recycle bin when you want to restore it.
7、查看npmAll versions of the package on the source,以 babel-core 为例:
npm view babel-core versions
8、安装包的最新版本,包含beta版,以 babel-core 为例:
npm install [email protected]
9、查看package-lock.jsonin the specific dependency tree(with open source librariestar为例):
npm ls tar
npmcache and global package locations(默认情况)
可以通过命令行”npm config get cache”获取缓存目录,This command can also be used for global paths”npm root -g”
mac下: /Users/apple/.npmrc (“apple”是自己的mac用户名)
window下:%APPDATA%/npm/node_modules
npm源管理工具:
nrm:npm install -g nrm
参考:
1、https://www.jianshu.com/p/e953bd426368
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/127518.html原文链接:https://javaforall.cn
边栏推荐
- Golang——从入门到放弃
- 【Yugong Series】July 2022 Go Teaching Course 023-List of Go Containers
- [Network Communication 3] Advantech Gateway Modbus Service Settings
- ECCV 2022 华科&ETH提出首个用于伪装实例分割的一阶段Transformer的框架OSFormer!代码已开源!...
- 【Yugong Series】July 2022 Go Teaching Course 021-Slicing Operation of Go Containers
- Automated testing - web automation - first acquaintance with selenium
- Golang 切片删除指定元素的几种方法
- After Effects 教程,如何在 After Effects 中调整过度曝光的快照?
- 手把手教你学会部署Nestjs项目
- MySQL---Subqueries
猜你喜欢
leetcode:6135. 图中的最长环【内向基环树 + 最长环板子 + 时间戳】
The new telecom "routine", my dad was tricked!
ResNet的基础:残差块的原理
Automated testing - web automation - first acquaintance with selenium
[Network Communication 3] Advantech Gateway Modbus Service Settings
After Effects 教程,如何在 After Effects 中调整过度曝光的快照?
新型电信“套路”,我爸中招了!
IP协议从0到1
GateWay实现负载均衡
认识异常 (看完这篇你就懂了)
随机推荐
cas与自旋锁(轻量级锁就是自旋锁吗)
UVM RAL模型和内置seq
IP协议从0到1
Huawei mobile phone one-click to open "maintenance mode" to hide all data and make mobile phone privacy more secure
ECCV 2022 华科&ETH提出首个用于伪装实例分割的一阶段Transformer的框架OSFormer!代码已开源!...
Flex布局详解
Mariabackup implements incremental data backup for Mariadb 10.3
Masterless Replication System (3)-Limitations of Quorum Consistency
MySQL---sort and pagination
MySQL - multi-table query
matplotlib ax bar color Set the color, transparency, label legend of the ax bar
Cache and Database Consistency Solutions
C# 之 扑克游戏 -- 21点规则介绍和代码实现
Golang 小数操作之判断几位小数点与四舍五入
Jiuqi ny3p series voice chip replaces the domestic solution KT148A, which is more cost-effective and has a length of 420 seconds
MySQL---运算符
【Yugong Series】July 2022 Go Teaching Course 022-Dictionary of Go Containers
How programmers learn open source projects, this article tells you
抖音根据关键词取视频列表 API
INeuOS industrial Internet operating system, the equipment operational business and "low code" form development tools