Hello all,
New to mocha here. I have npm install mocha --save-dev. I have a folder named test with an empty file messages.js. If I run mocha, I get the following error:
Mocha 3.1.2
events.js:160
throw er; // Unhandled 'error' event
^
Error: write EINVAL
at exports._errnoException (util.js:1022:11)
at WriteStream.Socket._writeGeneric (net.js:715:26)
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 c:\leoboto\node_modules\mocha\bin\_mocha:483:12
at Array.forEach (native)
at exit (c:\leoboto\node_modules\mocha\bin\_mocha:480:11)
at done (c:\leoboto\node_modules\mocha\lib\mocha.js:517:13)
at Runner.<anonymous> (c:\leoboto\node_modules\mocha\lib\runner.js:826:5)
at emitNone (events.js:91:20)
at Runner.emit (events.js:185:7)
at c:\leoboto\node_modules\mocha\lib\runner.js:813:12
at Runner.runSuite (c:\leoboto\node_modules\mocha\lib\runner.js:606:12)
at start (c:\leoboto\node_modules\mocha\lib\runner.js:811:10)
at Runner.run (c:\leoboto\node_modules\mocha\lib\runner.js:838:5)
at Mocha.run (c:\leoboto\node_modules\mocha\lib\mocha.js:521:17)
at Object.<anonymous> (c:\leoboto\node_modules\mocha\bin\_mocha:458:18)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.runMain (module.js:607:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
npm ERR! Test failed. See above for more details.
Mocha 2.5.3
events.js:160
throw er; // Unhandled 'error' event
^
Error: write EINVAL
at exports._errnoException (util.js:1022:11)
at WriteStream.Socket._writeGeneric (net.js:715:26)
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 c:\leoboto\node_modules\mocha\bin\_mocha:426:12
at Array.forEach (native)
at exit (c:\leoboto\node_modules\mocha\bin\_mocha:423:11)
at done (c:\leoboto\node_modules\mocha\lib\mocha.js:498:13)
at Runner.<anonymous> (c:\leoboto\node_modules\mocha\lib\runner.js:799:5)
at emitNone (events.js:91:20)
at Runner.emit (events.js:185:7)
at c:\leoboto\node_modules\mocha\lib\runner.js:786:12
at Runner.runSuite (c:\leoboto\node_modules\mocha\lib\runner.js:584:12)
at start (c:\leoboto\node_modules\mocha\lib\runner.js:784:10)
at Runner.run (c:\leoboto\node_modules\mocha\lib\runner.js:811:5)
at Mocha.run (c:\leoboto\node_modules\mocha\lib\mocha.js:502:17)
at Object.<anonymous> (c:\leoboto\node_modules\mocha\bin\_mocha:404:18)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.runMain (module.js:607:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
npm ERR! Test failed. See above for more details.
Windows 10
Node v7.1.0
Any ideas what could be causing this?
Hmm... So, this is an error calling process.stdout.write('', <callback>) or process.stderr.write('', <callback>). (Took me a moment to figure out the stack trace was from 2.5.3, but I found the code.) Are you piping or redirecting the output anywhere?
I'm not doing anything apart from the steps mentioned above - install mocha, create empty file, run mocha.
I realized, that the output in OP was from mocha 2.5.3. I have updated the OP with output from mocha 3.1.2.
Have it error on Windows 10 with Node v7.1.0 (mocha 2.5.3/3.1.2)
But with node v.7.0.0 and older work nice!.
This error in others projects
https://github.com/facebook/react-native/issues/10824
https://github.com/electron/electron/issues/7919
I filed an issue in the Node.js repo: https://github.com/nodejs/node/issues/9542
Please head over there in case you have any additional (and useful) information to share.
Thanks :octocat:
Reverting to LTS node version 6.9.1 solves the issue.
Thanks everyone for being one step ahead on this!
Most helpful comment
Have it error on Windows 10 with Node v7.1.0 (mocha 2.5.3/3.1.2)
But with node v.7.0.0 and older work nice!.