Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yarn: unable to verify the first certificate

Tags:

yarnpkg

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?

like image 360
Manikandan Avatar asked Oct 14 '16 02:10

Manikandan


People also ask

What is .yarnrc file?

yarnrc files allow you to configure additional Yarn features. The config command may also be used to set these options. Yarn will merge . yarnrc files up the file tree.

Which is better Yarn or NPM?

In terms of speed and performance Yarn is better than NPM because it performs parallel installation. Yarn is still more secure than NPM. However, Yarn uses more disk space than NPM.

How do I fix error self signed certificate in certificate chain?

To solve this, you'll need to install it as a trusted server. If it's signed by a non-trusted CA, you'll have to install that CA's certificate as well.


2 Answers

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 
like image 118
cgatian Avatar answered Oct 05 '22 21:10

cgatian


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> 
like image 32
trigoman Avatar answered Oct 05 '22 23:10

trigoman