gyp ERR, Npm is unable to get local issuer certificate
24,129
Solution 1
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
Solution 2
The answer from @Emon is correct, however for Linuz users the command obviously would be:
export NODE_TLS_REJECT_UNAUTHORIZED=0
Author by
metal_man
Updated on August 12, 2021Comments
-
metal_man over 2 years
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. -
sffc about 4 yearsGood as a temporary fix for development, but this should be avoided for deployment because it exposes you to man-in-the-middle attacks. Better is to properly set up SSL in your VM or container.
-
Peter Mølgaard Pallesen over 2 yearsOn my powershell I need to set it with 'set NODE_TLS_REJECT_UNAUTHORIZED 0'