Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gyp ERR, Npm is unable to get local issuer certificate

I am working on clean Windows 10 installation. Only thing is cygwin that I installed to get unix commands in the cmd.

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

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

But this does not work and I still receive the same error. What more, npm install also breaks with the same result.

like image 884
metal_man Avatar asked Oct 11 '17 12:10

metal_man


2 Answers

I had the same issue. Below solved my problem

set NODE_TLS_REJECT_UNAUTHORIZED=0 Then npm install again

You can refer to: https://github.com/nodejs/node-gyp/issues/695

like image 166
Emon Avatar answered Sep 21 '22 10:09

Emon


The answer from @Emon is correct, however for Linuz users the command obviously would be:

export NODE_TLS_REJECT_UNAUTHORIZED=0
like image 38
rakwaht Avatar answered Sep 21 '22 10:09

rakwaht