npm使用过程中遇到的错误以及常用的命令

npm install phantomjs-prebuilt@2.1.14 安装报错 最后通过以下命令安装成功:

npm install phantomjs-prebuilt@2.1.14 --ignore-scripts

1、关闭npm的https

npm config set strict-ssl false

2、设置npm的获取地址

npm config set registry "http://registry.npmjs.org/"

npm config set registry http://registry.npm.taobao.org

3、查看当前的npm获取地址

npm config get registry

4、查看系统中的全局路径

npm root -g

npm config get prefix

5、解决npm ERR!Windows_NT 6.1.7601 获取代理

npm config get proxy

设置代理为空

npm config set proxy null

然后设置

npm install cnpm -g --registry=https://registry.npm.taobao.org

6、更新npm版本

npm install npm -g

或者

npm install npm -g  --ca=null

8、错误代码

C:\Users\Administrator>npm install n -g
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@2.1.8: wanted {"os":"!win32","arch":"
any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\anzhuangweizhi\Node.js\node_cache\_logs\2017-07-12T05_54_29_264Z
-debug.log

解决方法 在后面加上 --force

C:\Users\Administrator>npm install -g n --force

9、错误代码

npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE

解决方法:关闭npm的https

npm config set strict-ssl false

10、如果安装vue-cli > vue init webpack demo 的时候一直报错

unable to verify the first certificate

,且转换镜像无效, 则:

开始 -》搜索-》regedit-》然后找到了注册表 按照下面的路径找到pro带头的文件删除  或者重命名 然后注销  (再次强调不要重启 不然没用)
进入注册表 之后 接着往下找

这个路径往下找HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings

转载于:https://my.oschina.net/lpcysz/blog/898185

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值