Yarn: Package not installing

Created on 31 Oct 2016  ·  35Comments  ·  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug

What is the current behavior?
yarn add package returns error

yarn-error.log file

Arguments: 
  /usr/local/bin/node /usr/share/yarn/bin/yarn.js global add express

PATH: 
  /home/saurav/anaconda2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/jdk1.8.0_91/bin:/home/saurav/.yarn/bin
Yarn version: 
  0.16.1

Node version: 
  6.9.1

Platform: 
  linux x64

npm manifest: 
  No manifest

yarn manifest: 
  No manifest

bower manifest: 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  Error: connect ECONNREFUSED 104.16.63.173:443
      at Object.exports._errnoException (util.js:1026:11)
      at exports._exceptionWithHostPort (util.js:1049:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)

error An unexpected error occured, please open a bug report with the information provided in "/home/saurav/.yarn-config/global/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
If the current behavior is a bug, please provide the steps to reproduce.
installing any package gives this error (both for globally or for any specific project)

What is the expected behavior?
Package should install properly

Please mention your node.js, yarn and operating system version.
Node 6.9.1
system: ubuntu 16.04

cat-backend triaged

Most helpful comment

@sauravskumar I faced a similar problem on a corporate network today. Turns out, I set npm registry to its http equivalent earlier, to speed up npm install

$ npm config set registry "http://registry.npmjs.org"

This was giving me the error, similar to yours. I tried by first resetting it back to default one

$ npm config set registry "https://registry.npmjs.org"

Now when I run yarn add or yarn global add; it runs to completion. You might want to check what is your npm registry setting.

All 35 comments

Can you ping 104.16.63.173 or ping registry.yarnpkg.com? It doesn't look like an yarn issue.

ping 104.16.63.173 works for me but ping registry.yarnpkg.com doesn't work for me...
but opening registry.yarnpkg.com in browser gives back the json below:
update:

{
"db_name": "registry",
"doc_count": 418107,
"doc_del_count": 354,
"update_seq": 1240682,
"purge_seq": 0,
"compact_running": false,
"disk_size": 2032316539,
"data_size": 1698616774,
"instance_start_time": "1477675441993351",
"disk_format_version": 6,
"committed_update_seq": 1240682
}

Can you suggest something please?

Can you post the output of curl -v https://registry.yarnpkg.com/?

curl -v https://registry.yarnpkg.com/ gives back the following output in terminal

saurav@saurav-Lenovo-G500:~$ curl -v https://registry.yarnpkg.com/
*   Trying 2400:cb00:2048:1::6810:3fad...
* Connected to registry.yarnpkg.com (2400:cb00:2048:1::6810:3fad) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /home/saurav/anaconda2/ssl/cacert.pem
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: OU=Domain Control Validated; OU=PositiveSSL Multi-Domain; CN=ssl462304.cloudflaressl.com
*  start date: Oct 11 00:00:00 2016 GMT
*  expire date: Oct 11 23:59:59 2017 GMT
*  subjectAltName: host "registry.yarnpkg.com" matched cert's "*.yarnpkg.com"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO ECC Domain Validation Secure Server CA 2
*  SSL certificate verify ok.
> GET / HTTP/1.1
> Host: registry.yarnpkg.com
> User-Agent: curl/7.49.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 31 Oct 2016 05:48:47 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Connection: keep-alive
< Set-Cookie: __cfduid=d0a0a4daa9b263ea7f07f0a521c4f8a0a1477892926; expires=Tue, 31-Oct-17 05:48:46 GMT; path=/; domain=.yarnpkg.com; HttpOnly
< Cache-Control: max-age=300
< Via: 1.1 varnish
< Age: 83
< X-Served-By: cache-sin6921-SIN
< X-Cache: HIT
< X-Cache-Hits: 1
< X-Timer: S1477892927.014256,VS0,VE0
< Vary: Accept-Encoding
< Server: cloudflare-nginx
< CF-RAY: 2fa4d1e95a0e1798-SIN
< 
* Connection #0 to host registry.yarnpkg.com left intact
{"db_name":"registry","doc_count":418107,"doc_del_count":354,"update_seq":2883826,"purge_seq":0,"compact_running":false,"disk_size":2032197755,"data_size":1698583043,"instance_start_time":"1477585942227105","disk_format_version":6,"committed_update_seq":2883826}

BTW, out of curiosity why are you trying to install express globally?

Can you just try yarn add react and post the output of tail yarn-error.log if it fails?

i did use at project level first... didn't work... so i just tried to see maybe if anything could install at all even if globally... still didn't work...

ya sure... same result..

On doing yarn add react

saurav@saurav-Lenovo-G500:~/WebstormProjects/atmed/yarn-test$ yarn add react
yarn add v0.16.1
info No lockfile found.
[1/4] Resolving packages...
error An unexpected error occured, please open a bug report with the information provided in "/home/saurav/WebstormProjects/atmed/yarn-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

output of tail yarn-error.log

saurav@saurav-Lenovo-G500:~/WebstormProjects/atmed/yarn-test$ tail yarn-error.log 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  Error: connect ECONNREFUSED 104.16.60.173:443
      at Object.exports._errnoException (util.js:1026:11)
      at exports._exceptionWithHostPort (util.js:1049:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)

Any suggestions?

Can you try this curl -v -4 https://registry.yarnpkg.com/.

output of curl -v -4 https://registry.yarnpkg.com/

saurav@saurav-Lenovo-G500:~/WebstormProjects/atmed/yarn-test$ curl -v -4 https://registry.yarnpkg.com/
*   Trying 104.16.63.173...
* Connected to registry.yarnpkg.com (104.16.63.173) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /home/saurav/anaconda2/ssl/cacert.pem
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: OU=Domain Control Validated; OU=PositiveSSL Multi-Domain; CN=ssl462304.cloudflaressl.com
*  start date: Oct 11 00:00:00 2016 GMT
*  expire date: Oct 11 23:59:59 2017 GMT
*  subjectAltName: host "registry.yarnpkg.com" matched cert's "*.yarnpkg.com"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO ECC Domain Validation Secure Server CA 2
*  SSL certificate verify ok.
> GET / HTTP/1.1
> Host: registry.yarnpkg.com
> User-Agent: curl/7.49.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 31 Oct 2016 06:06:56 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Connection: keep-alive
< Set-Cookie: __cfduid=d3ad852e83ad5499ab0aa70b4a8daa52a1477894016; expires=Tue, 31-Oct-17 06:06:56 GMT; path=/; domain=.yarnpkg.com; HttpOnly
< Cache-Control: max-age=300
< Via: 1.1 varnish
< Age: 154
< X-Served-By: cache-sin6922-SIN
< X-Cache: HIT
< X-Cache-Hits: 2
< X-Timer: S1477894016.897102,VS0,VE0
< Vary: Accept-Encoding
< Server: cloudflare-nginx
< CF-RAY: 2fa4ec813c1c2fb7-MAA
< 
* Connection #0 to host registry.yarnpkg.com left intact
{"db_name":"registry","doc_count":418115,"doc_del_count":354,"update_seq":1010430,"purge_seq":0,"compact_running":false,"disk_size":2032914555,"data_size":1698638601,"instance_start_time":"1477576902336982","disk_format_version":6,"committed_update_seq":1010430}

Create a test.js with the following content & then node test.js.

const https = require('https');

var options = {
  hostname: 'registry.yarnpkg.com',
  port: 443,
  path: '/',
  method: 'GET'
};

var req = https.request(options, (res) => {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);

  res.on('data', (d) => {
    process.stdout.write(d);
  });
});
req.end();

req.on('error', (e) => {
  console.error(e);
});

Error occures:

saurav@saurav-Lenovo-G500:~/WebstormProjects/atmed/yarn-test$ node test.js 
{ Error: connect ECONNREFUSED 104.16.61.173:443
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '104.16.61.173',
  port: 443 }

Something is wrong with your node installation. You can toggle registry.yarnpkg.com with encrypted.google.com in the above code and it should fail too.

I think you should close this issue. We can't help you further here. Thanks.

with encrypted.google.com ... no error... it works fine

saurav@saurav-Lenovo-G500:~/WebstormProjects/atmed/yarn-test$ node test.js 
statusCode: 200
headers: { date: 'Mon, 31 Oct 2016 06:26:41 GMT',
  expires: '-1',
  'cache-control': 'private, max-age=0',
  'content-type': 'text/html; charset=ISO-8859-1',
  p3p: 'CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."',
  server: 'gws',
  'x-xss-protection': '1; mode=block',
  'x-frame-options': 'SAMEORIGIN',
  'set-cookie': [ 'NID=89=IOHvnlIFdBmqDZwimiesBNbNhagPXp2YQnBke2KTZYpcvf0d9W8hzIwKvqaUefbXDDlS4YUSPWj8XQaPt-Yv16KUhEDSUj8w4vc2uPb6mmNOZ5IcV4j3XsnM6V5N5iPA; expires=Tue, 02-May-2017 06:26:41 GMT; path=/; domain=.google.com; HttpOnly' ],
  'alt-svc': 'quic=":443"; ma=2592000; v="36,35,34"',
  'accept-ranges': 'none',
  vary: 'Accept-Encoding',
  connection: 'close' }
<!doctype html>

and lot of html code ... any idea why yarn is not working?

Ok, that's better. But, it's still not an yarn issue like I mentioned before. I was just trying to help you to find a solution. Which is as you can see going nowhere.

So, now it's up to you. You can keep it open or close it. Have a good day. Bye.

@torifat Couldn't it be a bit of problem with yarn itself????

@torifat i tried it again with registry.yarnpkg.com ... now the output is somewhat positive... but still yarn add packagename does not work...

output with registry.yarnpkg.com and same code for test.js:

saurav@saurav-Lenovo-G500:~/WebstormProjects/atmed/yarn-test$ node test.js 
statusCode: 200
headers: { date: 'Mon, 31 Oct 2016 06:37:17 GMT',
  'content-type': 'text/plain',
  'transfer-encoding': 'chunked',
  connection: 'close',
  'set-cookie': [ '__cfduid=d0314d669f0dde42e0737101274e2deef1477895837; expires=Tue, 31-Oct-17 06:37:17 GMT; path=/; domain=.yarnpkg.com; HttpOnly' ],
  'cache-control': 'max-age=300',
  via: '1.1 varnish',
  age: '233',
  'x-served-by': 'cache-sin6921-SIN',
  'x-cache': 'HIT',
  'x-cache-hits': '2',
  'x-timer': 'S1477895837.525114,VS0,VE0',
  vary: 'Accept-Encoding',
  server: 'cloudflare-nginx',
  'cf-ray': '2fa518f83bca2fab-MAA' }
{"db_name":"registry","doc_count":418124,"doc_del_count":354,"update_seq":3591663,"purge_seq":0,"compact_running":false,"disk_size":2036129915,"data_size":1698671588,"instance_start_time":"1477577610427529","disk_format_version":6,"committed_update_seq":3591663}

Please help!

Here's what i found

running test.js with hostname: 'registry.yarnpkg.com' would return statusCode : 200 for about

3 out of 10 times and fail for the rest

where as running the same test.js with hostname: 'encrypted.google.com' would work
10 out of 10 times...

interesting... i'm not sure but there may be problem on the yarn side itself.. Can someone please help???? Thank You in advance

@sauravskumar I faced a similar problem on a corporate network today. Turns out, I set npm registry to its http equivalent earlier, to speed up npm install

$ npm config set registry "http://registry.npmjs.org"

This was giving me the error, similar to yours. I tried by first resetting it back to default one

$ npm config set registry "https://registry.npmjs.org"

Now when I run yarn add or yarn global add; it runs to completion. You might want to check what is your npm registry setting.

Similar issue #1645

I'm seeing a similar, but slightly different error. Trying to do create-react-app my-app, but it tells me warning There appears to be trouble with your network connection. Retrying....

The full output is:

yarn add v0.22.0
info No lockfile found.
warning There appears to be trouble with your network connection. Retrying...
[1/4] 🔍  Resolving packages...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".
info If you think this is a bug, please open a bug report with the information provided in "/Users/kc/dev/my-app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting my-app/ from /Users/kc/dev/
Done.

I tried curl on the failing URL and got a certificate error:

$ curl -v https://registry.yarnpkg.com/react
*   Trying 104.16.62.173...
* Connected to registry.yarnpkg.com (104.16.62.173) port 443 (#0)
* SSL certificate problem: Couldn't understand the server certificate format
* Closing connection 0
curl: (35) SSL certificate problem: Couldn't understand the server certificate format

I can hit the URL from my browser though and see the expected JSON response.

I was able to run this no problem from work.

Tried disabling my VPN too, but no difference.

Hmmm...ok...weird. I closed that console and opened a new console and it worked right away.

$ npm config set registry "https://registry.npmjs.org"
it works for me

Closing due to inactivity.

Same issue here.

@sauravskumar Are you behind a proxy server?

I fixed this problem by renaming yarn.lock to something else (1yarn.lock) and then running yarn install again ;D

@sitetester Thankyou thankyou! Been tearing my hair out... deleting yarn.lock worked for me as well.

To add to the SEO for this thread: I got this trying to run the sample app for AWS AppSync from a fresh install.

I have got the same problem - the reason was that I'm using Little Snitch which is network filter. When it's off, everything works perfect :)

if npm config set proxy
npm config delete proxy

Renaming yarn.lock to anything works fine to me

I'm had a similar issue trying to run yarn add css-loader
I tried renaming the yarn.lock and running yarn install but the same issue appeared, which was:

➜ my-app yarn add css-loader yarn add v1.3.2 [1/4] 🔍 Resolving packages... error An unexpected error occurred: "https://registry.yarnpkg.com/css-loader: connect ETIMEDOUT 104.18.98.96:443". info If you think this is a bug, please open a bug report with the information provided in "/Users/cazbrunnen/development/react-course-projects/indecision-app/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I deleted the node_modules folder and then ran yarn install again.
This seems to have solved the problem.

I have a similiar issue and I solve configuring my dns as 1.1.1.1 and 8.8.8.8

npmjs.org had an outage today, so you can check the status there:

https://status.npmjs.org/

Should be resolved now, but for future reference.

This is still not resolved for me.
After trying for hours, I got a package to install in a test project folder after doing what alayek said to do above.
I went back to the project I was working on, tried yarn add pkgname, and got the original failure.

registry.yarn.com gives me 404 in browser, ping, and curl.

yarn-error.log:

Trace: 
  Error: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443
      at errnoException (dns.js:50:10)
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

Issue is not resolved also for build on AWS using AWS CodeBuild (I use Docker image) and got error:

error An unexpected error occurred:
"https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443"

in my case i had an outdated yarn.lock file and i was able to fix it by simply deleting the yarn.lock file and reinstalling .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidmaxwaterman picture davidmaxwaterman  ·  3Comments

MunifTanjim picture MunifTanjim  ·  3Comments

sebmck picture sebmck  ·  3Comments

chiedo picture chiedo  ·  3Comments

bouk picture bouk  ·  3Comments