当前位置:网站首页>【Cnpm】使用教程
【Cnpm】使用教程
2022-06-24 06:43:00 【一颗不甘坠落的流星】
npm 由于源服务器在国外,下载 node 包速度较慢,cnpm 使用国内镜像,下载速度优于 npm
一、安装检测
- 安装后能检测出版本号,表示安装成功
# 安装指令
npm i cnpm -g
# 检测指令
cnpm -v
cnpm的使用:把npm的替换成cnpm就行- 比如:
npm i相当于cnpm i
二、两者区别
1.国内使用npm存在的问题
- 安装npm后,每次我们安装包时,我们的电脑都要和npm服务器进行对话,去npm仓库获取包。
- npm默认的仓库地址为:
http://registry.npmjs.org
# 查看当前npm仓库地址命令
* npm config get registry
http://registry.npmjs.org
- 因为npm的远程服务器在国外,所以有时候难免出现访问过慢,甚至无法访问的情况。
- 淘宝为我们搭建了一个国内的npm服务器,它目前是每隔10分钟将国外npm仓库的所有内容“搬运”回国内的服务器上,这样我们直接访问淘宝的国内服务器就可以了,
- 它的地址是:https://registry.npm.taobao.org
解决方法一:
- 直接安装cnpm 安装淘宝提供的cnpm,并更改服务器地址为淘宝的国内地址,
- 命令:
npm install -g cnpm --registry=https://registry.npm.taobao.org, - 以后安装直接采用cnpm替代npm,
- 例如原生npm命令为:
npm install uniq --save,cnpm命令为:cnpm install uniq --save
解决方法二:
- 替换npm仓库地址为淘宝镜像地址(推荐)
- 命令:
npm config set registry https://registry.npm.taobao.org, - 查看是否更改成功:
npm config get registry, - 以后安装时,依然用npm命令,但是实际是从淘宝国内服务器下载的
边栏推荐
- OMX initialization process
- 原神方石机关解密
- 0 foundation a literature club low code development member management applet (5)
- 【图像融合】基于NSST结合PCNN实现图像融合附matlab代码
- 华为云数据库进阶学习
- Spark项目打包优化实践
- How to make a website? What should I pay attention to when making a website?
- Can the small fire Chunfeng tea make its debut by "keeping fit"?
- JVM调试工具-jps
- How do I reinstall the system? How to install win10 system with USB flash disk?
猜你喜欢

【图像融合】基于NSST结合PCNN实现图像融合附matlab代码

【pointNet】基于pointNet的三维点云目标分类识别matlab仿真

Leetcode概率题面试突击系列11~15

Typora charges? Build vs Code markdown writing environment

Big factories are not the only way to measure ability. The three years' experience of Shangcai's graduation

Intranet learning notes (4)

Become TD hero, a superhero who changes the world with Technology | invitation from tdengine community

电脑如何打开软键盘,教大家Win10如何打开软键盘的方法

Intelligent Vision Group A4 paper recognition example

Huawei cloud image engine service
随机推荐
应用配置管理,基础原理分析
Why use lock [readonly] object? Why not lock (this)?
How to make a website? What should I pay attention to when making a website?
年中了,准备了少量的自动化面试题,欢迎来自测
One year since joining Tencent
Accelerate large-scale data analysis based on Apache iceberg through data organization optimization
【帧率倍频】基于FPGA的视频帧率倍频系统verilog开发实现
【小技巧】使用matlab的深度学习工具箱deepNetworkDesigner快速设计
JSON online parsing and the structure of JSON
华为云图引擎服务
Decryption of the original divine square stone mechanism
Win11分磁盘怎么分?Win11系统怎么分磁盘?
[problem solving] the connection to the server localhost:8080 was referred
【图像融合】基于伪 Wigner 分布 (PWD) 实现图像融合附matlab代码
0 foundation a literature club low code development member management applet (III)
【均衡器】LS均衡器,DEF均衡器以及LMMSE均衡器的误码率性能对比仿真
JVM调试工具-jstack
I failed to delete the database and run away
Record the problem location experience when an application is suddenly killed
Mysql---三张表(student,课程,分数) 查询课程为数学的学生姓名,编号,成绩