npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

前端 未结 10 1386
心在旅途
心在旅途 2020-12-07 07:50

I am trying all the ways of creating react application. I have tried with maven and now i am trying with crate-react-app build system from Facebook Incubators.

When

10条回答
  •  死守一世寂寞
    2020-12-07 08:40

    After trying out every solution I could find:

    • Turning off strict ssl: npm config set strict-ssl=false
    • Changing the registry to http instead of https: npm config set registry http://registry.npmjs.org/
    • Changing my cafile setting: npm config set cafile /path/to/your/cert.pem
    • Stop rejecting unknown CAs: set NODE_TLS_REJECT_UNAUTHORIZED=0

    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 .npmrc file. You can set it by entering this in your terminal: NODE_EXTRA_CA_CERTS=path/to/your/cert.pem

    Of course, setting this variable every time can be annoying, so I added it to my bash profile so that it will be set every time I open terminal. If you don’t already have a ~/.bash_profile file, create one. Then at the end of that file add export NODE_EXTRA_CA_CERTS=path/to/your/cert.pem. Then, remove the cafile setting in your .npmrc.

提交回复
热议问题