最近我由于某些原因无法使用git将代码上传到github,也无法使用npm来安装node模块。(我的操作系统是Windows 10)
在使用git时,我遇到了以下错误提示:
$ git push origin master fatal: unable to access
'https://github.com/$$$/$$$.git/': SSL certificate problem:
unable to get local issuer certificate
我在使用 npm 时遇到了以下错误:
npm install --save-dev webpack
npm WARN package.json 613@1.0.0 No description
npm WARN package.json 613@1.0.0 No README data
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "webpack"
npm ERR! node v4.4.4
npm ERR! npm v2.15.1
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! unable to verify the first certificate
npm 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! npm-debug.log
我升级了git到最新版本,但仍然出现同样的错误。我试着运行npm install -g npm来更新npm,但是还是出现同样的错误,所以我无法更新它。
我不理解SSL是如何工作的。据我所知,我没有任何SSL证书,因此我不知道它在找什么。我也不知道为什么现在才成为问题,几周前我还可以顺利使用git和npm。我不知道发生了什么改变……我在这个网站上找到的所有解决方案都是:
- 禁用SSL检查,但这听起来不安全
- 告诉git我的证书在哪里,我不知道该如何做
Loading latest certificates from
https://mxr.mozilla.org/nss/source/lib/ckfw/builtins/certdata.txt?raw=1
undefined
> { [Error: unable to verify the first certificate] code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
undefined
我尝试了简单地写require('ssl-root-cas').inject();
,但它并没有帮助我解决错误。
我不知道这是否相关,但我正在使用CovenantEyes。一些我查看的网站说代理可能是一个问题,CovenantEyes是一个代理吗?