SELF_SIGNED_CERT_IN_CHAIN error while using npm install - node.js

Whenever I run npm install , I get an error
Error: SELF_SIGNED_CERT_IN_CHAIN.
How to resolve this error?

Even I used to get this error. Try following steps.
Steps to be followed to overcome this error:
1) Run these three commands in a sequence.
npm config set strict-ssl false
npm update npm –g
npm config set strict-ssl true
2) Set properties proxy and https-proxy in the npm config using these commands:
npm config set proxy=“http://"proxy-name":8080”
npm config set https-proxy=“http://"proxy-name":8080”
Then try installing your packages using commands you tried.
Hope this helps.

Related

unable to use npm and yarn with proxy

I'm trying to create a strapi backend and I'm on a proxy server.
Everytime i run npx create-strapi-app#latest backend the err occurs
npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Neha\AppData\Local\npm-cache\_logs\2023-01-15T04_44_45_518Z-debug-0.log
I've read various stackoverflow questions regarding how to set proxy to npm but none worked for me.
I used below commands
npm config set proxy http://username:password#proxyname:8080
npm config set https-proxy http://username:password#proxyname:8080
npm config set strict-ssl false
after running all these commands, when i get my config list
npm config ls -l
it shows my proxy = null
; https-proxy = null ; overridden by user
; proxy = null ; overridden by user
I don't know what could be the reason.
Any help is much appreciated!
Thanks
Edit: It's fixed. Actually I changed my network :) and reset all proxies of npm, yarn and git

NVM - Unable to install expo dependencies

I am using nvm to switch between 4.4.3 and 12.14.1 node version.
After i Switched to version 12.14.1 and tried to install expo and run react-native project as stated here.
npm install -g expo-cli
expo init
npm start
But while running npm start i am getting the below error.
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz failed, reason:
self signed certificate in certificate chain
I followed the step as stated here.
So i ran the following command.
npm config set registry http://registry.npmjs.org/
But i am still getting the same error.Please help!
Also i dont intend to disable strict-ssl as stated
npm set strict-ssl false
Use following command to disable strict ssl-mode and you will not get the error:
npm set strict-ssl false

Unable to install ionic in windows using npm

I'm trying to install ionic using npm command
npm install -g ionic cordova
But installation failed. I'm have setup the proxy as well.
npm version:5.6.0
Proxy setup
npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/"
npm config set proxy "http://username:password#proxyip:8080/"
npm config set https-proxy "http://username:password#proxyip:8080/"
Since I cannot post the complete error details from the log, I have extracted the error message alone.
silly fetchPackageMetaData error for bn.js#^4.1.1 request to
http://registry.npmjs.org/bn.js failed, reason: connect ECONNREFUSED
proxyip:8080

npm WARN retry will retry, error on last attempt: Error: connect ECONNREFUSED

I just created a Asp.Net core application. But I am getting an error as below while I run the command npm install in command tool.
npm WARN retry will retry, error on last attempt: Error: connect ECONNREFUSED
Can anyone please help me what may be the issue here. Do we need to change any proxy settings, if yes, can you please explain me how to do it? Thank you.
Finally I was able to resolve the issue. I wanted to set the https-proxy using config command, as I was using my company LAN network. Below was the command I ran.
For https
npm config set https-proxy http://yourpoxysettingsgoeshere:6050/
For http
npm config set proxy http://yourpoxysettingsgoeshere:6050/
You can also set the strict-ssl to false as below.
npm config set strict-ssl false
After running it, I was able to use the npm install command.
npm install -g #angular/cli
Thank you.

Node Js: Error - Unable to verify leaf signature when installing Express Framework

I need to install Express Framework for my application.
This is the error which I am obtaining. I tried to set Environment varaibales for my computer towards npm as http://username:password#proxy:port for both http and https.
Also, I have tried the code such as
npm config set proxy http://username:password#proxy:port -g
npm config set https-proxy http://username:password#proxy:port -g
npm config set strict-ssl false.
Even then I am getting the below error.
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! unable to verify the first certificate
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
Any help regarding installing Express Framework would be appreciated.
I have also faced same problem, but your last option i.e.
npm config set strict-ssl false worked for me.
after run this command in command prompt I installed express framework with following command:
npm install -g express-generator
Even I got the same error while installing angular cli...
I have used the command "npm config set strict-ssl false" in cmd and then installed using npm install -g #angular/cli...It worked...Thanks
npm config set strict-ssl false should fix it.
In my case it was in a docker environment and I did not copied the .yarnrc that included the sstrict-ssl false directive to the image in the build phase.
Issue:
>npm install
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/#webassemblyjs/ieee754/-/ieee754-1.7.6.tgz failed, reason: unable to verify the first certificate
Solution:
npm install worked after executing this command:
npm config set strict-ssl false

Resources