M-Zuber/npm-watch

Warning when missing watch key in package.json

kristianmandrup opened this issue · 3 comments

Node v. 7.1

$ npm-watch
/usr/local/lib/node_modules/npm-watch/watch-package.js:96
    stdin.stderr.write(message)
         ^

TypeError: Cannot read property 'stderr' of undefined
    at die (/usr/local/lib/node_modules/npm-watch/watch-package.js:96:10)
    at watchPackage (/usr/local/lib/node_modules/npm-watch/watch-package.js:16:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm-watch/cli.js:12:15)

Should be a message more like Error: Missing watch key in package.json for npm-watch

So the source of that error is here which is actually trying to display 'No "watch" config in package.json'
Hopefully I can reproduce on my machine (and fix of course)

I did some more digging, and I am not quite sure how this ever worked. Am assuming that there is something I missed (or it was just never reported).

In addition, I discovered that if you have watch with multiple keys, it always tries to run all of them. Seems to me something that needs to be adjusted.

Just published 0.1.7 to deal with the immediate concern.

Please let me know if there are any more issues in this regard