简体   繁体   中英

npm install self-signed certificate error

I have created a yeoman generator that I would like installable as a node module. This is to make installing the custom generator a one-step process where other developers on the team can simply do npm install git+https://path-to-local-git-server/generator-repo.git .

I believe I have everything setup correctly but npm croaks on the self-signed certificate with the following error

npm ERR! fatal: unable to access 'https://path-to-local-git-server/generator-repo.git': SSL certificate problem: self signed certificate

I have tried to make npm ignore certificate warnings with npm config set strict-ssl false and npm config set ca="" but npm still complains about the certificate

Please help. The alternative would be to have users clone the git repo and do an npm install with the path to their clone which is not so desirable because I would like to version and maintain the genrator in a manner that they can update using npm.

This is actually error thrown by git.

You have to set up ~/.gitconfig and add the following line:

[http]
    sslCAInfo=/path/to/your/certificate/file.pem

It's done.

PS don't know why no answer here, and I found this question today because I have the same problem. It is solved, and put the answer here, if someone needs it in the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM