![]() ![]() ![]() ![]() The solution that seems to be working the best for me now is to use the NODE_EXTRA_CA_CERTS environment variable which extends the existing CAs rather than replacing them with the cafile option in your. Stop rejecting unknown CAs: set NODE_TLS_REJECT_UNAUTHORIZED=0.Changing my cafile setting: npm config set cafile /path/to/your/cert.pem.Changing the registry to http instead of https: npm config set registry.Turning off strict ssl: npm config set strict-ssl=false.I forgot I found a script that helps with this and Git (for cloning GitHub repos via HTTPS had the same issue) and forked it for my useīasically, it does the following for git: git config -global http.proxy Īnd for Node, it adds proxy= to the end of c:\Users\$USERNAME\npm\.npmrcĪfter trying out every solution I could find: In my case, the proxy at my employer (ZScaler) was causing issues (as it acts as a MITM, causing certification verification issues) Solution 3Ĭhanging the NPM repo URL to HTTP works as a quick-fix, but I wanted to use HTTPS. Ideally you would be able to use your system's trusted certificates, but unfortunately this is not the case. This fix basically tells npm and node-gyp to use the check against the regular CAs, but also allow this certificate when it comes across it I couldn't seem to get it to work with relative paths (. Make sure your certificates are in proper pem format (you need real line breaks not literal \n) The pem file can have multiple certificates: If you're using node 7 or later I've found this fix to be compatible with node and node-gyp (for Windows you'll need to do this differently, but you basically just need to add this environment variable):Įxport NODE_EXTRA_CA_CERTS="absolute_path_to_your_certificates.pem" (in Windows you may need to remove the quotes) What may be happening is your company decrypts certain traffic and re-encrypts it with their certificate (which you probably already have in your keychain or trusted root certificates) This worked perfectly and I got a success message Happy Hacking! by not setting the strict-ssl flag to false. Later I found a safe and working solution, npm config set registry But as a part of my work environment, I am restricted to set the strict-ssl flag to false. A quick solution from the internet search was npm config set strict-ssl false, luckily it worked.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |