Closed kevinsawicki closed 9 years ago
Try invoking node-gyp with NODE_TLS_REJECT_UNAUTHORIZED=0
.
Hello @TooTallNate! I'm Sorry, can you tell where to register it? Not in the .npmrc file? I've been struggling with him for 4 days :(
From command line
set NODE_TLS_REJECT_UNAUTHORIZED=0
and then you can run
npm install
Hello, I have also encountered this problem,My computer is windows7 Stack Error: self signed certificate in certificate chain Gyp ERR! stack at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34) Gyp ERR! stack at TLSSocket.emit (events.js:189:13) Gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:633:8)... I tried npm config set ca=null; NODE_TLS_REJECT_UNAUTHORIZED=0; npm set strict-ssl false; Re-uninstall the global node-gyp, reload, but still does not solve the problem, I also updated the npm version; also executed the following command: npm config set ca "" Npm install npm -g Npm config delete ca The contents of my .npmrc file are: Ca = "" Msvs_version = "2015" Python = "python2.7" Registry = "http://registry.npm.taobao.org/" Strict-ssl = false
When I execute npm install, I still report this error. The above action does not work. I am very anxious. People who want to know can help me. My error is this: ⨯ cannot execute cause=exit status 1 Out= > pcsclite@0.6.0 install C:\codeing\demo\node_modules\pcsclite > node-gyp rebuild
C:\codeing\NfcClientTool\ClientTool\node_modules\pcsclite>if not defined npm_config_node_gyp (node "C:\Users\houhongf\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\ ....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\hf\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin \node-gyp.js" rebuild )
errorOut=gyp WARN install got an error, rolling back install
Gyp ERR! configure error
Gyp ERR! stack Error: self signed certificate in certificate chain
Gyp ERR! stack at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34)
Gyp ERR! stack at TLSSocket.emit (events.js:189:13)
Gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:633:8)
Gyp ERR! System Windows_NT 6.1.7601
Gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\hf\AppData\Roaming\npm\node_modules\npm\node_modules\node -gyp\bin\node-gyp.js" "rebuild"
Gyp ERR! cwd C:\codeing\demo\node_modules\pcsclite
Gyp ERR! node -v v10.15.3
Gyp ERR! node-gyp -v v5.0.2
Gyp ERR! not ok
Npm ERR! code ELIFECYCLE
Npm ERR! errno 1
Npm ERR! pcsclite@0.6.0 install: node-gyp rebuild
Npm ERR! Exit status 1
Npm ERR!
Npm ERR! Failed at the pcsclite@0.6.0 install script.
Npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Npm ERR! A complete log of this run can be found in: Npm ERR! C:\Users\hf\AppData\Roaming\npm-cache_logs\2019-07-15T09_54_57_333Z-debug.log
Command='C:\Program Files\nodejs\node.exe' 'C:\Users\hf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js' rebuild buffertools@2.1.6 pcsclite@0.6 .0 sqlite3@4.0.9
workingDir=
Npm ERR! code ELIFECYCLE
Npm ERR! errno 1
Npm ERR! client-tool@1.0.0 postinstall: electron-builder install-app-deps
Npm ERR! Exit status 1
Npm ERR!
Npm ERR! Failed at the demo-tool@1.0.0 postinstall script.
Npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Thank you very much! God bless you!
For Windows users, at an elevated command prompt:
cd %USERPROFILE%\.windows-build-tools
msiexec /i python-2.7.15.amd64.msi
You can probably also add /qb
to msiexec
if you want a silent install.
vs_buildtools.exe
can be downloaded from https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=buildtools&rel=16&utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=offline+install&utm_content=download+vs2019
Is there a solution that actually works? I tried every suggestion...
set NODE_TLS_REJECT_UNAUTHORIZED=0
npm install -g --unsafe-perm binding
added 1 package in 13s
npm config set strict-ssl false
set npm_config_cafile "C:\path\to\certificate.pem"
npm config set cafile "C:\path\to\certificate.pem" --global
set NODE_EXTRA_CERTS="C:\path\to\certificate.pem"
set NODE_EXTRA_CA_CERTS="C:\path\to\certificate.pem"
... and node-gyp
still fails:
node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.13.0 | win32 | x64
gyp info find Python using Python version 3.9.7 found at "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe" gyp http GET https://nodejs.org/download/release/v18.13.0/node-v18.13.0-headers.tar.gz gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.13.0/node-v18.13.0-headers.tar.gz failed, reason: self-signed certificate in certificate chain
gyp ERR! stack at ClientRequest.<anonymous> (C:\Users\bla\AppData\Roaming\npm\node_modules\node-gyp\node_modules\minipass-fetch\lib\index.js:130:14)
gyp ERR! stack at ClientRequest.emit (node:events:513:28)
gyp ERR! stack at TLSSocket.socketErrorListener (node:_http_client:496:9)
gyp ERR! stack at TLSSocket.emit (node:events:525:35)
gyp ERR! stack at emitErrorNT (node:internal/streams/destroy:151:8)
gyp ERR! stack at emitErrorCloseNT (node:internal/streams/destroy:116:3)
gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\bla\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\bla\my\current\directory
gyp ERR! node -v v18.13.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
I also tried to manually download the tar.gz as described here: https://github.com/nodejs/help/issues/3686#issuecomment-1011865975, but that didn't change anything. Even if I have the tar.gz file in the \tmp directory, the command fails, because the commands loads multiple files, not only the tar.gz.
Maybe I could load those files manually, but without knowing every file which is downloaded in the process, that doesn't work either. Additionally, installing something with npm install
doesn't work either: npm ERR! RequestError: self-signed certificate in certificate chain
This might be connected to the issues https://github.com/nodejs/node/issues/3742, https://github.com/nodejs/node-gyp/issues/695 and the already mentioned https://github.com/nodejs/help/issues/3686, but the recommendations there are similar to those here.
None of the other methods worked for me (see https://github.com/nodejs/node-gyp/issues/448#issuecomment-1486405865), but this command finally solved the problem (on Windows 11):
$env:NODE_EXTRA_CA_CERTS="C:\path\to\certificate.crt"
node-gyp
and npm
now work without any problems.
This doesn't seem to be possible currently when running
node-gyp install
.Being able to disable strict SSL on the download request would prevent this error (I hope):