node icon indicating copy to clipboard operation
node copied to clipboard

EINVAL errors (events.js:160) with Node 7.1.0 on Windows 10

Open mischah opened this issue 10 years ago • 69 comments

  • Version: 7.1.0
  • Platform: Windows 10
  • Subsystem: Events

Hej there,

several users have problems with different packages running node 7.1.0 on Windows 10:

  • https://github.com/mochajs/mocha/issues/2577
  • https://github.com/facebook/react-native/issues/10824
  • https://github.com/electron/electron/issues/7919
  • https://github.com/yeoman/yo/issues/485
  • https://github.com/yeoman/yo/issues/486

All of them seem to have the following in common:

  • It used to work with node 7.0.0 and stopped working with 7.1.0
  • A similiar error with different stacktrace:
events.js:160
      throw er; // Unhandled 'error' event

Error: write EINVAL

Could you enlighten us? Is it a regression in Node.js?

Thanks, Michael

mischah avatar Nov 10 '16 11:11 mischah

@cjihrig @icflorescu Node.js v7.1.0 + latest libuv v1.x branch seems to be working fine with both https://github.com/kyrylkov/webpack and mocha

Here is the latest Win 64-bit build of node.exe to verify:

https://mega.nz/#!WIlB0DaC!wIiY0Nv3sI0NvXODdXHqjK4kgoEso3s7kcE-RmiZ8uA

skcc75 avatar Nov 15 '16 22:11 skcc75

FYI - I plan to start on the libuv release soon.

cjihrig avatar Nov 16 '16 15:11 cjihrig

@cjihrig Great!

skcc75 avatar Nov 16 '16 15:11 skcc75

@kyrylkov : Your binary does the trick for me. Complex webpack project is working, including console color support.

killroy42 avatar Nov 16 '16 17:11 killroy42

libuv update PR is at https://github.com/nodejs/node/pull/9647, if anyone wants to give it a whirl.

cjihrig avatar Nov 16 '16 18:11 cjihrig

@kyrylkov : The new binary works for me too, so I guess it's ok to push. @kyrylkov and @cjihrig : You're doing an awesome job!

icflorescu avatar Nov 16 '16 19:11 icflorescu

@cjihrig I'll make another build

skcc75 avatar Nov 16 '16 20:11 skcc75

@cjihrig Verified. Node.js master branch with libuv 1.10.0 fails https://github.com/kyrylkov/webpack, but PR https://github.com/nodejs/node/pull/9647 fixes the issue.

skcc75 avatar Nov 16 '16 21:11 skcc75

I'd like to test this. I may have a related issue with bluebird/request-promise, documented at https://github.com/request/request-promise/issues/166. It silently fails only in Windows + v7.1.0.

PS: I've never had reason to test with a dev branch, but would be willing to contribute. Some instructions would be helpful though. :) Or, the script that shows the flaw can be found in the request-promise ticket, if someone wants to test with it.

paulxtiseo avatar Nov 16 '16 22:11 paulxtiseo

Also, have a similar silently failing return initially logged in https://github.com/vitaly-t/pg-promise/issues/236? Distinction in both cases is no error percolates up...

paulxtiseo avatar Nov 16 '16 22:11 paulxtiseo

ESLint received a bug report from @danZib a few days ago that seems to also be related to the libuv upgrade (windows-only IO failure on Node 7). I'll add it to this issue in case it's related.

Error message:
events.js:160
throw er; // Unhandled 'error' event
^
Error: This socket is closed
at WriteStream.Socket._writeGeneric (net.js:683:19)
at WriteStream.Socket._write (net.js:734:8)
at doWrite (_stream_writable.js:334:12)
at writeOrBuffer (_stream_writable.js:320:5)
at WriteStream.Writable.write (_stream_writable.js:247:11)
at WriteStream.Socket.write (net.js:661:40)
at Console.log (console.js:43:16)
at process.once.err (C:\Users\Daniel\AppData\Roaming\npm\node_modules\eslint\bin\eslint.js:50:17)
at process.g (events.js:292:16)
at emitOne (events.js:96:13)

It apparently happens on a console.log call when this code is run. It only fails on windows, and only with Node 7. (I didn't encounter the issue myself, so I'm unable to verify whether libuv 1.10.1 fixes the issue.)

not-an-aardvark avatar Nov 16 '16 23:11 not-an-aardvark

In which version will this rollback land? 7.1.1?

killroy42 avatar Nov 17 '16 15:11 killroy42

There is a Node v7 release tentatively scheduled for this coming Tuesday. I believe it will be 7.1.1. If any semver minor commits are included, it will be 7.2.0.

cjihrig avatar Nov 17 '16 15:11 cjihrig

Hello, on my windows 10, I uninstalled node v 7.1.0 and reinstalled 6.9.1, and it worked normally ...

The error was:

Error: This socket is closed at WriteStream.Socket._writeGeneric (net.js:683:19) at WriteStream.Socket._write (net.js:734:8) at doWrite (_stream_writable.js:334:12) at writeOrBuffer (_stream_writable.js:320:5) at WriteStream.Writable.write (_stream_writable.js:247:11) at WriteStream.Socket.write (net.js:661:40) at WriteStream.stream.write (C:\Users\m.nunes.abrantes\Documents\Projeto\react_ative\testereact\node_modules\ansi\lib\newlines.js:36:21) at Console.warn (console.js:51:16) at process.on (internal/process/warning.js:21:17) at emitOne (events.js:96:13)

AbrantesMar avatar Nov 22 '16 19:11 AbrantesMar

I'm pretty sure it's fixed in the nightlies, or wait for 7.1.1

seanzer avatar Nov 22 '16 20:11 seanzer

@seanzer, 7.1.1 nightly was release on Nov 9th. That did not fix the problem. I'm waiting for a new release which is supposed to happen tonight. @AbrantesMar, 7.0.0 works fine as well.

tonydearaujo avatar Nov 22 '16 20:11 tonydearaujo

Feedback: Node 7.2.0, released last night, has solved my problem, which was serving Angular CLI projects on Windows 10. Thank you!

tonydearaujo avatar Nov 23 '16 12:11 tonydearaujo

Node 7.2 also resolved my problem with react-native run-android on Win10

erwinjulius avatar Nov 23 '16 16:11 erwinjulius

We're trying to bring back to libuv the functionality that caused this regression (with fixes, of course). Before merging it, it would be great if someone could confirm that it does not cause any problems. The PR in question is: https://github.com/libuv/libuv/pull/1143. Thanks in advance. /cc @kyrylkov

santigimeno avatar Nov 28 '16 18:11 santigimeno

@santigimeno So current Node v7.2.0 or v7.x branch plus libuv with https://github.com/libuv/libuv/pull/1143 ?

skcc75 avatar Nov 28 '16 19:11 skcc75