cnpm安装和使用

查看npm源地址:

npm config get registry

npm官方源地址:

https://registry.npmjs.org

淘宝镜像源地址:

https://registry.npmmirror.com

1.临时使用

npm --registry https://registry.npmmirror.com install express

2.持久使用(推荐)

npm config set registry https://registry.npmmirror.com

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

npm config get registry 或 npm info express

3.通过cnpm使用(推荐)

npm install -g cnpm --registry=https://registry.npmmirror.com

4、使用cnpm
cnpm install xxx
5、升级cnpm淘宝镜像为最新版本

npm install npm@latest -g cnpm --registry=https://registry.npmmirror.com

6、用npm命令使用淘宝镜像
npm自身就默认代的镜像:http://registry.npmjs.org

npm config set registry https://registry.npmmirror.com

如果用npm命令使用淘宝镜像,再次修改为npm的淘宝链接:

npm config set registry https://registry.npmmirror.com

7、cnpm命令没反应
1、cnpm -v、cnpm install等等cnpm命令执行了都只是跳到下一行就毫无反应。试了npm是没问题的

2、上百度搜了下列三种方式尝试都还是不行
设置环境变量。没用
删除C盘用户目录下的.npmrc文件。也没有用
执行npm config set registry https://registry.npmmirror.com还是没用

3、就试着卸载cnpm重新安装试试,果然可以了
卸载 npm uninstall -g cnpm --registry=https://registry.npmmirror.com
注册 npm set registry https://registry.npmmirror.com
解析 npm set disturl hhttps://registry.npmmirror.com/dist
安装 npm install -g cnpm --registry=https://registry.npmmirror.com

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值