yarn icon indicating copy to clipboard operation
yarn copied to clipboard

[bug] socket hang up

Open iyn opened this issue 10 years ago • 39 comments

Do you want to request a feature or report a bug? Bug

What is the current behavior? When running yarn with existing (and correct) package.json and empty node_modules I get socket hang up error on a X package. Next time I run yarn I get the same error, but for Y package.

Example output:

$ yarn                                                                                                                                                                   
yarn install v0.15.1
info No lockfile found.
[1/4] Resolving packages...
error https://registry.yarnpkg.com/semver: socket hang up
    at createHangUpError (_http_client.js:252:15)
    at TLSSocket.socketCloseListener (_http_client.js:284:23)
    at emitOne (events.js:101:20)
    at TLSSocket.emit (events.js:188:7)
    at TCP._handle.close [as _onclose] (net.js:493:12)

If the current behavior is a bug, please provide the steps to reproduce. Hard to think of steps to reproduce the issue. Below are my dependencies:

  "dependencies": {
    "axios": "^0.14.0",
    "babel-polyfill": "^6.13.0",
    "babel-runtime": "^6.11.6",
    "classnames": "^2.2.5",
    "dom-helpers": "^2.4.0",
    "elemental": "^0.6.1",
    "flexboxgrid": "^6.3.1",
    "get-env": "^0.5.1",
    "icheck": "^1.0.2",
    "immutable": "^3.8.1",
    "js-combinatorics": "^0.5.2",
    "localforage": "^1.4.2",
    "lodash": "^4.15.0",
    "moment": "^2.15.1",
    "moment-duration-format": "^1.3.0",
    "normalizr": "^2.2.1",
    "qs": "^6.2.1",
    "ramda": "^0.22.1",
    "rc-time-picker": "^2.0.2",
    "react": "^15.3.2",
    "react-addons-css-transition-group": "^15.3.2",
    "react-addons-shallow-compare": "^15.3.2",
    "react-addons-transition-group": "^15.3.2",
    "react-dates": "^3.1.1",
    "react-dom": "^15.3.2",
    "react-flexbox-grid": "^0.10.2",
    "react-highlight-words": "^0.4.1",
    "react-icheck": "^0.3.5",
    "react-popover": "^0.4.4",
    "react-redux": "^5.0.0-beta.3",
    "react-responsive": "^1.1.5",
    "react-router": "^2.7.0",
    "react-router-redux": "^4.0.5",
    "react-select": "^1.0.0-rc.1",
    "react-selectize": "^2.0.3",
    "react-skylight": "^0.4.1",
    "react-smooth-collapse": "^1.1.0",
    "react-tabs": "^0.8.0",
    "react-virtualized": "^8.0.11",
    "reactstrap": "^3.4.0",
    "recharts": "^0.14.1",
    "redux": "^3.6.0",
    "redux-actions": "^0.12.0",
    "redux-form": "^6.1.0",
    "redux-logger": "^2.6.1",
    "redux-logic": "^0.9.3",
    "redux-thunk": "^2.1.0",
    "reselect": "^2.5.4",
    "rxjs": "^5.0.0-beta.12",
    "tether": "^1.3.7",
    "uuid-js": "^0.7.5"
  },
  "devDependencies": {
    "autoprefixer": "^6.4.0",
    "babel-core": "^6.14.0",
    "babel-eslint": "^6.1.2",
    "babel-loader": "^6.2.5",
    "babel-plugin-transform-class-properties": "^6.11.5",
    "babel-plugin-transform-object-rest-spread": "^6.8.0",
    "babel-plugin-transform-runtime": "^6.12.0",
    "babel-preset-es2015": "^6.14.0",
    "babel-preset-es2016": "^6.11.3",
    "babel-preset-es2017": "^6.14.0",
    "babel-preset-react": "^6.11.1",
    "css-loader": "^0.24.0",
    "eslint": "^3.4.0",
    "eslint-config-airbnb-base": "^5.0.3",
    "eslint-import-resolver-webpack": "^0.5.1",
    "eslint-plugin-import": "^1.14.0",
    "eslint-plugin-jsx-a11y": "^2.2.0",
    "eslint-plugin-lodash-fp": "^2.0.1",
    "eslint-plugin-react": "^6.2.0",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "file-loader": "^0.9.0",
    "handlebars": "^4.0.5",
    "handlebars-loader": "^1.3.0",
    "html-webpack-plugin": "^2.22.0",
    "node-sass": "^3.10.1",
    "postcss-loader": "^0.11.1",
    "postcss-modules-values": "^1.2.2",
    "postcss-scss": "^0.2.1",
    "postcss-strip-inline-comments": "^0.1.5",
    "precss": "^1.4.0",
    "react-immutable-proptypes": "^2.1.0",
    "react-moment-proptypes": "^1.2.0",
    "sass-loader": "^4.0.2",
    "source-map-loader": "^0.1.5",
    "style-loader": "^0.13.1",
    "stylelint": "^7.2.0",
    "stylelint-config-standard": "^13.0.0",
    "stylelint-webpack-plugin": "^0.3.1",
    "url-loader": "^0.5.7",
    "webpack": "2.1.0-beta.21",
    "webpack-dashboard": "^0.1.8",
    "webpack-dev-server": "2.1.0-beta.1"
  }

What is the expected behavior? Yarn should install all packages, npm works just fine with my current setup.

Please mention your node.js, yarn and operating system version. yarn: 0.15.1 OS: Linux 4.7.6-1 node: v6.6.0

I suppose this may be the problem with servers being overloaded but I'm posting this issue in case there's something else and this is in fact some bug.

iyn avatar Oct 11 '16 17:10 iyn

OK, it seems that it's not yarn specific problem. I've just run npm install and it also failed (where it was ok very recently). The npm error log is more verbose though:


> [email protected] install /home/user/projects/p1/node_modules/node-sass
> node scripts/install.js

Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-48_binding.node": ode:

ESOCKETTIMEDOUT

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> [email protected] postinstall /home/user/projects/p1/node_modules/node-sass
> node scripts/build.js

"/home/user/projects/p1/node_modules/node-sass/vendor/linux-x64-48/binding.node" exists.
 testing binary.
[1]    23887 bus error (core dumped)  npm install

iyn avatar Oct 11 '16 18:10 iyn

I am getting the socket hang up issue also, but do not get the issue when running npm install

From my package.json:

  "dependencies": {
    "pg": "^6.1.0"
  },
  "devDependencies": {
    "jasmine": "^2.5.2",
    "jasmine-spec-reporter": "^2.7.0",
    "mock-require": "^1.3.0"
  }
λ yarn install
yarn install v0.15.1
info No lockfile found.
warning [email protected]: No license field
[1/4] Resolving packages...
error socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1049:19)
    at TLSSocket.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at TLSSocket.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:913:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

One thing I do know is that our corporate firewall is currently blocking yarnpkg.com and should hopefully be cleared up tomorrow some time. Not sure if this is an issue.

annapoulakos avatar Oct 11 '16 19:10 annapoulakos

This is also happening to me. But like for @jimpoulakos , npm i is working fine

gitnik avatar Oct 12 '16 14:10 gitnik

Windows 10, 512kbps... I can't finish any install. Lots of (random) socket hang ups. NPM works properly most of the time

Example:

yarn add v0.15.1 info No lockfile found. [1/4] Resolving packages... error https://registry.yarnpkg.com/babel-preset-es2015-node: socket hang up at createHangUpError (_http_client.js:252:15) at TLSSocket.socketOnEnd (_http_client.js:344:23) at emitNone (events.js:91:20) at TLSSocket.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

jromero2k avatar Oct 12 '16 20:10 jromero2k

I'm reopening this issue, since other people seem to be affected by it.

iyn avatar Oct 12 '16 20:10 iyn

Not sure if this issue has been fixed but I'm also getting the same issue when doing yarn with empty node_modules directory. I have tested it with npm install and it works correctly though without any problem.

But yarn gives this error and halts:

 ➜ yarn
yarn install v0.15.1
info No lockfile found.
[1/4] Resolving packages...
warning grunt > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning grunt > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning grunt-modernizr > customizr > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning wiredep > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning grunt-modernizr > customizr > [email protected]: use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) or [cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
warning generator-jhipster > yo > [email protected]: cross-spawn no longer requires a build toolchain, use it instead!
warning generator-jhipster > yeoman-generator > cross-spawn > [email protected]: cross-spawn no longer requires a build toolchain, use it instead!
warning grunt > glob > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning wiredep > bower-config > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning protractor > request > [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning yo > fullname > [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
error https://registry.yarnpkg.com/binary-extensions: socket hang up
    at createHangUpError (_http_client.js:250:15)
    at TLSSocket.socketCloseListener (_http_client.js:282:23)
    at emitOne (events.js:101:20)
    at TLSSocket.emit (events.js:188:7)
    at TCP._handle.close [as _onclose] (net.js:485:12)
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

kabirbaidhya avatar Oct 13 '16 04:10 kabirbaidhya

same problem here "socket hang up"

younesmln avatar Oct 13 '16 23:10 younesmln

Same problem about "socket hang up" I set a http_proxy.

keysona avatar Oct 14 '16 03:10 keysona

I am getting the socket hang up issue too

yofine avatar Oct 14 '16 03:10 yofine

it's happening to me

yoohan-dex avatar Oct 14 '16 07:10 yoohan-dex

Same problem here.

sxcsfan avatar Oct 14 '16 07:10 sxcsfan

Same problem. The error appears randomly at different packages. Here is a sample:

error https://registry.yarnpkg.com/postcss-modules-extract-imports: socket hang up at createHangUpError (_http_client.js:252:15) at TLSSocket.socketCloseListener (_http_client.js:284:23) at emitOne (events.js:101:20) at TLSSocket.emit (events.js:188:7) at TCP._handle.close as _onclose info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

It doesn't matter if a node_modules directory exist or not. npm i works fine. If I didn't find this thread and due to the randomness of the error, I would have thrown the blame on my horrible ISP. However, surely not everyone here has a stone age internet connection!

abdulhaq-e avatar Oct 15 '16 00:10 abdulhaq-e

Same here. I think it is related to Internet speed. I'm not sure how Yarn works internally but I believe it fetches more than one package at a time with no limit (correct me if I'm wrong), so with weak/slow internet connections it produces many random socket hang ups and timeouts. I tried to install angular-cli for days and couldn't succeed but with npm it installs with no problem. It I am right, there should be a way to limit concurrent connections.

masihyeganeh avatar Oct 15 '16 09:10 masihyeganeh

@masihyeganeh I think you are right. I just came home where I have regular internet connection and yarn works as expected (whereas when I had this error, I was on unstable mobile connection). Also agree, that it would be good to have the feature to limit opened sockets.

iyn avatar Oct 15 '16 18:10 iyn

Same problem here.

shinygang avatar Oct 17 '16 03:10 shinygang

I think this is one of the major issues as I couldn't start working on a existing project using yarn after I did rm -rf node_modules/ and tried yarn, as the installation wouldn't just complete. So, I have to fallback to npm install anyway to make it work. However, this works in the projects with only few dependencies. But for the projects with large number of dependencies it fails with this socket hang up error.

kabirbaidhya avatar Oct 17 '16 04:10 kabirbaidhya

Same problem here.

kshern avatar Oct 17 '16 08:10 kshern

I think it is related to Internet speed.

I can confirm this. At home I only have 2Mbit/s and it does not work there. At work I have a decently fast Internet connection and I don't get any errors.

michel-kraemer avatar Oct 17 '16 09:10 michel-kraemer

I agree, bandwidth is the problem. After 5 attempts I moved closer to the router and it is working

johmsalas avatar Oct 18 '16 03:10 johmsalas

@masihyeganeh @michel-kraemer I agree. It's network speed problem.

keysona avatar Oct 18 '16 09:10 keysona