npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Allow suppression of errors via package.json

I would love to be able to suppress messages when running npm once I’ve decided that they’re spurious.

I think the team have definitely made the right decision to show all these info, warning and error messages by default. However, it would be nice if we could selectively suppress them - ideally via package.json. As an example, it would be nice if we could suppress the fsevents optional dependency warnings that appear every time I run npm, since I can do nothing about this message and it doesn’t add value (and more importantly, adds noise around other potentially crucial messages).

I don’t know whether suppression would be general or whether you’d have the ability to specify the package name(s) with which it is associated. My preference is that this would be in package.json rather than a command line switch. Maybe the decision would be taken that it’s off by default, and that in order to pay attention to this list of suppressed messages, a command line switch would need to be applied. That seems like a sensible approach. I’m not too keen on an approach that involves specifying it at the command line every time i.e. an --ignore-optional switch or similar.

I’m relatively inexperienced with dev so this idea may have flaws and I may well missed something vital. Maybe there is already a sensible and generalised approach to warning message suppression that I’m not aware of - apologies if so!

Here is a related idea with a possible solution, take a look.