EINVAL errors (events.js:160) with Node 7.1.0 on Windows 10
- 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
This is a problem of the version node, use the version 6.9 and success
Can someone check if https://github.com/libuv/libuv/pull/1139 also fixes the issue?
@santigimeno https://github.com/libuv/libuv/pull/1139 solves the problem with mocha, but not with webpack-dev-server.
Running webpack-dev-server results in a different error after patching:
npm ERR! node v7.1.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! webapp@ dev: `webpack-dev-server --progress`
npm ERR! Exit status 3221226505
this is what im getting with the patch:

This was the command I ran to install it (after patching and building x64 Debug) node.exe ../deps/npm/cli.js install webpack-dev-server --save-dev
@iWuzHere did you build a 32-bit version by any chance?
@kyrylkov ~~its 64-bit debug build~~
Can confirm it works on 32bit builds
.\vcbuild.bat x86 debug nosign

I can confirm the exe in https://github.com/nodejs/node/issues/9542#issuecomment-259958895 works when installing and running an Electron app, which broke with node v7.1.0 on Windows 10 (x64).
@iWuzHere @santigimeno
It still crashes for us with webpack-dev-server and our config on 2 different projects.
Built from v7.1.0 with vcbuild x64 nosign release and the following patch applied:
C:\Users\kyryl\dev\node>git diff
diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c
index 18d68d0..1e397b4 100644
--- a/deps/uv/src/win/tty.c
+++ b/deps/uv/src/win/tty.c
@@ -1650,7 +1650,7 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
uv_buf_t buf = bufs[i];
unsigned int j;
- if (uv__vterm_state == UV_SUPPORTED) {
+ if (uv__vterm_state == UV_SUPPORTED && buf.len > 0) {
utf16_buf_used = MultiByteToWideChar(CP_UTF8,
0,
buf.base,
C:\Users\kyryl\dev\test\www>npm run dev
> [email protected] dev C:\Users\kyryl\dev\test\www
> webpack-dev-server
http://localhost:8080/webpack-dev-server/
webpack result is served from /
content is served from C:\Users\kyryl\dev\test\www
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v7.1.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `webpack-dev-server`
npm ERR! Exit status 3221226505
npm ERR!
npm ERR! Failed at the [email protected] dev script 'webpack-dev-server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the test-web package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs test-web
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls test-web
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\kyryl\dev\test\www\npm-debug.log
npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 silly lifecycle [email protected]~predev: no script for predev, continuing
7 info lifecycle [email protected]~dev: [email protected]
8 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~dev: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\kyryl\dev\test\www\node_modules\.bin;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\CloudFoundry;C:\Program Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program Files\MongoDB\Server\3.2\bin;C:\Program Files\Cloud Foundry;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\kyryl\AppData\Local\Microsoft\WindowsApps;C:\Users\kyryl\AppData\Roaming\npm;C:\adb;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\nodejs\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\kyryl\AppData\Local\Microsoft\WindowsApps;C:\Users\kyryl\AppData\Roaming\npm
10 verbose lifecycle [email protected]~dev: CWD: C:\Users\kyryl\dev\test\www
11 silly lifecycle [email protected]~dev: Args: [ '/d /s /c', 'webpack-dev-server' ]
12 silly lifecycle [email protected]~dev: Returned: code: 3221226505 signal: null
13 info lifecycle [email protected]~dev: Failed to exec dev script
14 verbose stack Error: [email protected] dev: `webpack-dev-server`
14 verbose stack Exit status 3221226505
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\kyryl\dev\test\www
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
19 error node v7.1.0
20 error npm v3.10.9
21 error code ELIFECYCLE
22 error [email protected] dev: `webpack-dev-server`
22 error Exit status 3221226505
23 error Failed at the [email protected] dev script 'webpack-dev-server'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the test-web package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error webpack-dev-server
23 error You can get information on how to open an issue for this project with:
23 error npm bugs test-web
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls test-web
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Hi @kyrylkov - can you share out your repro environment please? I tried another project which uses webpack-dev-server- vue-hackernews- and it seems to work ok. I did the following:
Copied a patched version of node with the fix to the node install directory
git clone https://github.com/vuejs/vue-hackernews/
cd vue-hackernews
npm install
npm run dev
And it seems to work ok. I'm happy to try similar steps with your repro environment. One other thing I notice in your logs- it looks like the error code you get is ELIFECYCLE instead of EINVAL, which suggests it might be a different issue than the one being discussed in this thread.
@kyrylkov You guys probably don't need any more information at this point in time, but I wanted to confirm that your updated node.exe (from https://github.com/nodejs/node/issues/9542#issuecomment-259958895) solves the problem when running npm install for the project electron-quick-start.
@digitalinfinity @bnoordhuis @iWuzHere @santigimeno
Here you go https://github.com/kyrylkov/webpack
Using Node.js 7.1.0 patched by https://github.com/libuv/libuv/pull/1139 npm run dev will result in:
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `webpack-dev-server`
npm ERR! Exit status 3221226505
The normal behavior (Node.js 7.0.0 and before) should be:
> [email protected] dev C:\Users\kyryl\dev\test
> webpack-dev-server
http://localhost:8080/webpack-dev-server/
webpack result is served from /
content is served from C:\Users\kyryl\dev\test
Hash: cd017a465b5922221e3e
Version: webpack 1.13.3
Time: 683ms
Asset Size Chunks Chunk Names
bundle.js 262 kB 0 [emitted] main
chunk {0} bundle.js (main) 223 kB [rendered]
[0] multi main 52 bytes {0} [built]
[1] (webpack)/hot/dev-server.js 1.79 kB {0} [built]
[2] (webpack)/hot/log-apply-result.js 788 bytes {0} [built]
[3] (webpack)-dev-server/client?http://localhost:8080 3.97 kB {0} [built]
[4] ./~/url/url.js 22.3 kB {0} [built]
[5] ./~/url/~/punycode/punycode.js 14.6 kB {0} [built]
[6] (webpack)/buildin/module.js 241 bytes {0} [built]
[7] ./~/querystring/index.js 127 bytes {0} [built]
[8] ./~/querystring/decode.js 2.4 kB {0} [built]
[9] ./~/querystring/encode.js 2.09 kB {0} [built]
[10] ./~/strip-ansi/index.js 161 bytes {0} [built]
[11] ./~/ansi-regex/index.js 135 bytes {0} [built]
[12] (webpack)-dev-server/client/socket.js 856 bytes {0} [built]
[13] ./~/sockjs-client/lib/entry.js 244 bytes {0} [built]
[14] ./~/sockjs-client/lib/transport-list.js 613 bytes {0} [built]
[15] ./~/sockjs-client/lib/transport/websocket.js 2.71 kB {0} [built]
[16] ./~/process/browser.js 5.3 kB {0} [built]
[17] ./~/sockjs-client/lib/utils/event.js 2 kB {0} [built]
[18] ./~/sockjs-client/lib/utils/random.js 746 bytes {0} [built]
[19] ./~/sockjs-client/lib/utils/browser-crypto.js 438 bytes {0} [built]
[20] ./~/sockjs-client/lib/utils/url.js 975 bytes {0} [built]
[21] ./~/url-parse/index.js 9.92 kB {0} [built]
[22] ./~/requires-port/index.js 753 bytes {0} [built]
[23] ./~/url-parse/lolcation.js 1.58 kB {0} [built]
[24] ./~/querystringify/index.js 1.3 kB {0} [built]
[25] ./~/debug/browser.js 3.76 kB {0} [built]
[26] ./~/debug/debug.js 4.1 kB {0} [built]
[27] ./~/ms/index.js 2.33 kB {0} [built]
[28] ./~/inherits/inherits_browser.js 672 bytes {0} [built]
[29] ./~/sockjs-client/lib/event/emitter.js 1.27 kB {0} [built]
[30] ./~/sockjs-client/lib/event/eventtarget.js 1.85 kB {0} [built]
[31] ./~/sockjs-client/lib/transport/browser/websocket.js 172 bytes {0} [built]
[32] ./~/sockjs-client/lib/transport/xhr-streaming.js 1.25 kB {0} [built]
[33] ./~/sockjs-client/lib/transport/lib/ajax-based.js 1.31 kB {0} [built]
[34] ./~/sockjs-client/lib/transport/lib/sender-receiver.js 1.15 kB {0} [built]
[35] ./~/sockjs-client/lib/transport/lib/buffered-sender.js 2.3 kB {0} [built]
[36] ./~/sockjs-client/lib/transport/lib/polling.js 1.32 kB {0} [built]
[37] ./~/sockjs-client/lib/transport/receiver/xhr.js 1.58 kB {0} [built]
[38] ./~/sockjs-client/lib/transport/sender/xhr-cors.js 343 bytes {0} [built]
[39] ./~/sockjs-client/lib/transport/browser/abstract-xhr.js 4.8 kB {0} [built]
[40] ./~/sockjs-client/lib/transport/sender/xhr-local.js 352 bytes {0} [built]
[41] ./~/sockjs-client/lib/utils/browser.js 560 bytes {0} [built]
[42] ./~/sockjs-client/lib/transport/xdr-streaming.js 984 bytes {0} [built]
[43] ./~/sockjs-client/lib/transport/sender/xdr.js 2.46 kB {0} [built]
[44] ./~/sockjs-client/lib/transport/eventsource.js 766 bytes {0} [built]
[45] ./~/sockjs-client/lib/transport/receiver/eventsource.js 1.58 kB {0} [built]
[46] ./~/sockjs-client/lib/transport/browser/eventsource.js 37 bytes {0} [built]
[47] ./~/sockjs-client/lib/transport/lib/iframe-wrap.js 981 bytes {0} [built]
[48] ./~/sockjs-client/lib/transport/iframe.js 3.83 kB {0} [built]
[49] ./~/json3/lib/json3.js 43.3 kB {0} [built]
[50] (webpack)/buildin/amd-options.js 42 bytes {0} [built]
[51] ./~/sockjs-client/lib/version.js 26 bytes {0} [built]
[52] ./~/sockjs-client/lib/utils/iframe.js 5.06 kB {0} [built]
[53] ./~/sockjs-client/lib/utils/object.js 532 bytes {0} [built]
[54] ./~/sockjs-client/lib/transport/htmlfile.js 710 bytes {0} [built]
[55] ./~/sockjs-client/lib/transport/receiver/htmlfile.js 2.2 kB {0} [built]
[56] ./~/sockjs-client/lib/transport/xhr-polling.js 894 bytes {0} [built]
[57] ./~/sockjs-client/lib/transport/xdr-polling.js 712 bytes {0} [built]
[58] ./~/sockjs-client/lib/transport/jsonp-polling.js 1.02 kB {0} [built]
[59] ./~/sockjs-client/lib/transport/receiver/jsonp.js 5.57 kB {0} [built]
[60] ./~/sockjs-client/lib/transport/sender/jsonp.js 2.46 kB {0} [built]
[61] ./~/sockjs-client/lib/main.js 11.9 kB {0} [built]
[62] ./~/sockjs-client/lib/shims.js 18.2 kB {0} [built]
[63] ./~/sockjs-client/lib/utils/escape.js 2.31 kB {0} [built]
[64] ./~/sockjs-client/lib/utils/transport.js 1.35 kB {0} [built]
[65] ./~/sockjs-client/lib/utils/log.js 450 bytes {0} [built]
[66] ./~/sockjs-client/lib/event/event.js 477 bytes {0} [built]
[67] ./~/sockjs-client/lib/location.js 177 bytes {0} [built]
[68] ./~/sockjs-client/lib/event/close.js 295 bytes {0} [built]
[69] ./~/sockjs-client/lib/event/trans-message.js 292 bytes {0} [built]
[70] ./~/sockjs-client/lib/info-receiver.js 2.22 kB {0} [built]
[71] ./~/sockjs-client/lib/transport/sender/xhr-fake.js 456 bytes {0} [built]
[72] ./~/sockjs-client/lib/info-iframe.js 1.52 kB {0} [built]
[73] ./~/sockjs-client/lib/info-iframe-receiver.js 791 bytes {0} [built]
[74] ./~/sockjs-client/lib/info-ajax.js 1.03 kB {0} [built]
[75] ./~/sockjs-client/lib/iframe-bootstrap.js 2.9 kB {0} [built]
[76] ./~/sockjs-client/lib/facade.js 723 bytes {0} [built]
[77] ./entry.js 0 bytes {0} [built]
webpack: bundle is now VALID.
@kyrylkov That looks like a different issue to me. The error code is ELIFECYCLE and the exit code is 0xC0000409 in hex, which seems to indicate a system configuration issue. (MS KB is kind of vague on its exact meaning.)
@bnoordhuis This is different, but it doesn't exist in v7.0.0 and in v7.1.0 with rolled back https://github.com/nodejs/node/commit/106d71914cdee2136e03253f38d90ad57577ab33.
The point is that (v7.1.0 + https://github.com/libuv/libuv/pull/1139) still results in a regression (albeit different) as far as we are concerned, while (v7.1.0 + rolled back https://github.com/nodejs/node/commit/106d71914cdee2136e03253f38d90ad57577ab33) seems to remove all regressions.
Running webpack-dev-server on v7.1.0 + https://github.com/libuv/libuv/pull/1139 applied works fine, but as soon as basic webpack.config.js is added along with a plugin (extract-text-webpack-plugin), Node.js crashes with ELIFECYCLE error.
Somebody with Win 10 64-bit needs to clone https://github.com/kyrylkov/webpack and confirm.
@bnoordhuis @kyrylkov confirmed:
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v7.1.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `webpack-dev-server`
npm ERR! Exit status 3221226505
...
Works in v7.0.0:
$ nvm use 7.0
7.0.0
Now using node v7.0.0 (64-bit)
ionut@Aspire-V5 MINGW64 ~/Work/webpack (master)
$ npm run dev
...
[76] ./~/sockjs-client/lib/facade.js 723 bytes {0} [built]
[77] ./entry.js 0 bytes {0} [built]
webpack: bundle is now VALID.
We're going to try completely reverting the commit that we believe is responsible. See https://github.com/libuv/libuv/pull/1138.
The revert landed. Anyone (@icflorescu, @kyrylkov, etc.) willing to give the current libuv 1.x branch a shot before I make a release?
@cjihrig So Node 7.1.0 branch + libuv 1.x branch?
Yes. There was some revert dancing going on, so it might be simplest to just use the libuv v1.x branch instead of individual commits.