gyp ERR,Npm 无法获取本地发行人证书 [英] gyp ERR, Npm is unable to get local issuer certificate
问题描述
我正在处理干净的 Windows 10 安装.唯一的问题是我安装了 cygwin 以在 cmd 中获取 unix 命令.
I am working on clean Windows 10 installation. Only thing is cygwin that I installed to get unix commands in the cmd.
当我输入 npm install -g @angular/cli
时,它会下载必要的文件,但我收到一个错误:
When I type npm install -g @angular/cli
it downloads the necessary files but I receive an error:
gyp ERR! configure error
gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1092:38)
gyp ERR! stack at emitNone (events.js:86:13)
gyp ERR! stack at TLSSocket.emit (events.js:185:7)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:610:8)
gyp ERR! stack at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\user\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\node-sass
gyp ERR! node -v v6.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
我编辑了 npm 配置文件,如npm config edit".在打开的文件中,我添加了以下设置:
I edited npm config file like 'npm config edit'. In the opened file I added the following settings:
strict-ssl=false
http_proxy=null
proxy=null
但这不起作用,我仍然收到相同的错误.更重要的是,npm install
也会以相同的结果中断.
But this does not work and I still receive the same error. What more, npm install
also breaks with the same result.
推荐答案
我遇到了同样的问题.下面解决了我的问题
I had the same issue. Below solved my problem
设置 NODE_TLS_REJECT_UNAUTHORIZED=0
然后再次npm install
可以参考:https://github.com/nodejs/node-gyp/issues/695
这篇关于gyp ERR,Npm 无法获取本地发行人证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!