Closed kentor closed 9 years ago
Hmm I will look into it, the last problem I had like this there was an application that was wrapping stdin which caused it to throw the same error. What version of node are you using?
0.12.7
I'm having the exact same problem since I updated eslint-watch today. I use the npm package parallelshell
to run multiple file watcher at the same time, like this in my package.json:
"watch:eslint": "esw -w",
"watch": "set NODE_ENV=development&& parallelshell \"npm run watch:eslint\" \"npm run watch:js\" \"npm run watch:less\" \"npm run live-reload\" "
This has worked fine in a previous version but as I can see the keyListener
function in cli.js has only been added recently. One workaround I can think of is to check if stdin.setRawMode
is available. Or maybe make the keyListener optional through a parameter?
I'm also using node 0.12.7
@simonvizzini What eslint-watch version were you on before you upgraded?
@rizowski can't check right now but i'm pretty sure it was 1.2.5, seems that the keyListener function has been added in version 2.0.0
@simonvizzini Can you run the same esw command with DEBUG=esw:*
in front and paste the output. For me it runs the watch without the exception.
Sure, here is the output:
esw:eslint-cli .cmd +0ms
esw:eslint-cli J:\source\EmbeddedChat\EmbeddedChat\node_modules\.bin\eslint.cmd +2ms
esw:eslint-help Help text received +700ms
esw:eslint-help Alias found: -c +1ms
esw:eslint-help Parsing --config +1ms
esw:eslint-help Parsing --no-eslintrc +1ms
esw:eslint-help Parsing --env +0ms
esw:eslint-help Parsing --ext +0ms
esw:eslint-help Parsing --global +1ms
esw:eslint-help Parsing --parser +0ms
esw:eslint-help Parsing --cache +1ms
esw:eslint-help Parsing --cache-file +0ms
esw:eslint-help Parsing --rulesdir +0ms
esw:eslint-help Parsing --plugin +1ms
esw:eslint-help Parsing --rule +0ms
esw:eslint-help Parsing --ignore-path +0ms
esw:eslint-help Parsing --no-ignore +0ms
esw:eslint-help Parsing --ignore-pattern +1ms
esw:eslint-help Parsing --stdin +0ms
esw:eslint-help Parsing --stdin-filename +1ms
esw:eslint-help Parsing --quiet +0ms
esw:eslint-help Parsing --max-warnings +0ms
esw:eslint-help Alias found: -o +0ms
esw:eslint-help Parsing --output-file +1ms
esw:eslint-help Alias found: -f +0ms
esw:eslint-help Parsing --format +1ms
esw:eslint-help Parsing --no-color +0ms
esw:eslint-help Parsing --init +0ms
esw:eslint-help Parsing --fix +1ms
esw:eslint-help Parsing --debug +0ms
esw:eslint-help Alias found: -h +0ms
esw:eslint-help Parsing --help +1ms
esw:eslint-help Alias found: -v +0ms
esw:eslint-help Parsing --version +1ms
esw:esw-cli Arguments passed: node,J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\bin\esw,-w,./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk +5ms
esw:esw-cli Parsing args +3ms
esw:arg-parser Directories to check: ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk +0ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +1ms
esw:arg-parser contains J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\bin\esw +2ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +1ms
esw:arg-parser contains ./ChatUI.JavaScript/src/app +1ms
esw:arg-parser Pushing item: ./ChatUI.JavaScript/src/app +0ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +0ms
esw:arg-parser contains ./ChatUI.JavaScript/src/sdk +1ms
esw:arg-parser Pushing item: ./ChatUI.JavaScript/src/sdk +0ms
esw:arg-parser getPath: simple-detail +1ms
esw:esw-cli Running initial lint +0ms
Linting: ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk
esw:esw-cli -w seen +6ms
TypeError: undefined is not a function
TypeError: undefined is not a function
at keyListener (J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\src\cli.js:43:9)
at J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\src\cli.js:58:7
at J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\src\options.js:41:7
at Socket.<anonymous> (J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\src\eslint\help.js:75:7)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at Pipe.onread (net.js:538:20)
When you say it runs the watch without exception for you, do you mean it works for you even when stdin
is wrapped, like in my case with parallelshell? Are you on Linux/Mac or Windows? Because running the esw command normally through the command prompt (I'm on Windows) works fine, it just throws this exception when run through parallelshell. By the way I just checked the previous version I've used and it was 1.2.4, not 1.2.5, so I've downgraded to 1.2.4 for the time being.
I am on a mac right now that I primarily use for dev. I will check when I get home to see if I can get a similar thing to come up. I am pretty sure it will. I'm not a 100% confident that checking if the method is there will fix the issue. But I have a few thoughts on how to approach it. I will poke around it later this evening and iron it out.
@simonvizzini I should have a fix for you. If you wouldn't mind testing it out to see if it works with your environment that would be great. It's currently on the branch exceptions
.
@rizowski that works for me
@rizowski hmm, but if I Ctrl+C before it finishes linting, I get the prompt back but the process still runs in the background, until the linting finishes i think
@kentor I was wondering if that might happen. I'll take another look at it and see what I can do.
@kentor Try the latest changes on the same branch. I moved everything within the keylistener. That should make it so it doesn't set anything up on stdin if the process is being wrapped.
Yes the latest on exceptions
seems to be working for me.
Sorry for the late reply, didn't had the chance until now to try it out. I can confirm that the exceptions
branch works fine for me! Thanks a lot! Any ETA when you will publish a new npm package?
@kentor @simonvizzini I am publishing it right now. 2.1.2 should contain the fix. #45 #44
Thanks! :+1:
Hi again, I finally updated all my devDependencies in my package.json and it seems I still have problems with the latest eslint-watch version (2.1.2)
There are no more exceptions regarding the original issue with the keyListener at startup, so in that regard everything seems fine. The initial full-lint runs also fine, but when I change a JS file with some errors in it then nothing happens, no console output at all. It seems like the file watcher isn't really watching.
Any idea what could be the problem? I'm not sure if this is related to this issue or not, if you want I can create a new issue. Downgrading to 1.2.4 makes the file watcher work again.
Here is some debug output:
> chat-ui@0.0.1 watch:eslint J:\source\EmbeddedChat\EmbeddedChat
> set DEBUG=esw:*&& esw -w ./ChatUI.JavaScript/src/app ./ChatUI.JavaScript/src/sdk
esw:eslint-cli .cmd +0ms
esw:eslint-cli J:\source\EmbeddedChat\EmbeddedChat\node_modules\.bin\eslint.cmd +3ms
esw:eslint-help Executing help +607ms
esw:eslint-help Help text received +774ms
esw:eslint-help Alias found: -c +2ms
esw:eslint-help Parsing --config +1ms
esw:eslint-help Parsing --no-eslintrc +3ms
esw:eslint-help Parsing --env +4ms
esw:eslint-help Parsing --ext +2ms
esw:eslint-help Parsing --global +4ms
esw:eslint-help Parsing --parser +4ms
esw:eslint-help Parsing --cache +3ms
esw:eslint-help Parsing --cache-file +3ms
esw:eslint-help Parsing --rulesdir +3ms
esw:eslint-help Parsing --plugin +4ms
esw:eslint-help Parsing --rule +3ms
esw:eslint-help Parsing --ignore-path +3ms
esw:eslint-help Parsing --no-ignore +4ms
esw:eslint-help Parsing --ignore-pattern +3ms
esw:eslint-help Parsing --stdin +3ms
esw:eslint-help Parsing --stdin-filename +3ms
esw:eslint-help Parsing --quiet +3ms
esw:eslint-help Parsing --max-warnings +3ms
esw:eslint-help Alias found: -o +4ms
esw:eslint-help Parsing --output-file +3ms
esw:eslint-help Alias found: -f +3ms
esw:eslint-help Parsing --format +3ms
esw:eslint-help Parsing --no-color +4ms
esw:eslint-help Parsing --init +3ms
esw:eslint-help Parsing --fix +3ms
esw:eslint-help Parsing --debug +3ms
esw:eslint-help Alias found: -h +4ms
esw:eslint-help Parsing --help +3ms
esw:eslint-help Alias found: -v +3ms
esw:eslint-help Parsing --version +3ms
esw:esw-cli Arguments passed: node,J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\bin\esw,-w,./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk +7ms
esw:esw-cli Parsing args +5ms
esw:arg-parser Directories to check: ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk +2ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +3ms
esw:arg-parser contains J:\source\EmbeddedChat\EmbeddedChat\node_modules\eslint-watch\bin\esw +3ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +3ms
esw:arg-parser contains ./ChatUI.JavaScript/src/app +3ms
esw:arg-parser Pushing item: ./ChatUI.JavaScript/src/app +3ms
esw:arg-parser [ 'esw', 'iojs', 'node' ] +2ms
esw:arg-parser contains ./ChatUI.JavaScript/src/sdk +3ms
esw:arg-parser Pushing item: ./ChatUI.JavaScript/src/sdk +3ms
esw:arg-parser getPath: simple-detail +3ms
esw:esw-cli Running initial lint +2ms
Linting: ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk
esw:esw-cli -w seen +10ms
Watching ./ChatUI.JavaScript/src/app,./ChatUI.JavaScript/src/sdk
✓ Clean (16:52:46)
esw:esw-cli Exiting setting exit code to: 0 +1s
@simonvizzini That seems like an unrelated issue. Can you create an issue for that?
Sorry again for the late reply, I'm currently overloaded with work, but have finally created a new issue. Thanks for the help :)
package.json:
shell:
The watching doesn't work when the process is in the background.