Check for errors in NPM output and reject command#78
Check for errors in NPM output and reject command#78shaunburdick wants to merge 1 commit intoAnifacted:masterfrom
Conversation
|
@shaunburdick Thank you for your contribution! 🙏 You have indeed spotted a shortcoming that needs fixing. I am tempted to merge in your changes, but I wonder if there are any unforeseen side-effects related to rejecting this promise while installing multiple packages in multiple destinations. Ideally, the error would be isolated to the specific install and not blow up the whole session. Another point regarding the implementation specifically, is that |
|
Yeah, I didn't feel great about this fix. I agree that maybe a better solution would be to update |
Added some code to check for NPM errors when running a command and reject the promise. (see #49)
From the outside,
lernaupdateseemed to be working happily, however there was a permission error in one of my packages that was resulting in an npm error. There was no way to tell that error was happening. I only noticed when I went to commit the updatedpackage.jsonand noticed there were no changes.Example of the output:

(had to redact the output a little for... reasons)
I think there are a few caveats:
stderrinfo that is not an error (warnings and such) so I made sure the output contained at least onenpm ERR!pattern. This is probably ok but kind of fragile. I can't think of a better way to do it at this point.