Yarn: unable to verify the first certificate

别来无恙 提交于 2020-06-24 01:55:08

问题


I'm trying to migrate from npm to Yarn. When I tried to install dependencies through yarn, I'm getting this error.

unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1055:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:580:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:412:38)

Same works fine with npm. Tried setting proxy, didn't help.Is there any configuration I need to change?


回答1:


If the certificate is unable to be verfied, you can open set strict-ssl to false. You should be able to configure this by runnning

yarn config set "strict-ssl" false -g

But the command is currently not working, see issue 980.

As an alternative you can navigate to C:\Users\\ and open .yarnrc and manually update it as follows:

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
strict-ssl false



回答2:


This means that more than likely you're behind a corporate proxy that uses a self signed certificate. I'm using version v0.16.1, and you can fix this by providing the public certificate to the yarn configuration like so:

yarn config set cafile <path-to-certificate.pem>



回答3:


I had this error when trying to install the React Devtools Extensions behind a corporate proxy with correct certificates setup locally. The yarn.lock file contains many references to https://registry.yarnkpg.com which was bypassing our corporate Nexus.

I was able to install by running:

yarn install --no-lockfile


来源:https://stackoverflow.com/questions/40033794/yarn-unable-to-verify-the-first-certificate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!