安装npm包的时候出现unable to get local issuer certificate的错误解决办法

来源:互联网 发布:vc 6.0 安装包 知乎 编辑:程序博客网 时间:2024/05/15 23:50

我本地的npm是通过node.js安装包安装之后来的,在安装有些npm包的时候很正常,但是当我安装superagent时出错了,具体的错误信息如下:

npm ERR! Windows_NT 6.1.7601npm ERR! argv "H:\\e\\Program Files\\nodeJs\\node.exe" "H:\\e\\Program Files\\nodeJs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "superagent"npm ERR! node v6.9.1npm ERR! npm  v3.10.8npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLYnpm ERR! unable to get local issuer certificatenpm ERR!npm ERR! If you need help, you may report this error at:npm ERR!     <https://github.com/npm/npm/issues>npm ERR! Please include the following file with any support request:npm ERR!     H:\g\webTest\nodeTest\npm-debug.log

在多次排查之后,依然毫无头绪。通过在npm项目issue中发现有同样问题,发现执行下面语句即可:

npm config set strict-ssl false 

或者在主目录下的.npmrc文件中修改strict-ssl等于false

参考:

  • https://github.com/npm/npm/issues/14667
  • https://docs.npmjs.com/misc/config
0 0