How to ignore code analysis errors in node_modules?

I have a nodejs project that the IDE labels as being in an error state (red squiggle on root) because it found an error inside node_modules.  Specifically, inside the monk module's own node_modules directory, the mongoskin module has a file index.js that reads

module.exports = process.env.MONGOSKIN_COV ? require('./lib-cov/') : require('./lib/');

The error is that it can't resolve ./lib-cov.  Of course, it doesn't need to, because the environment variable isn't set.

Anyway, it would be nice if WebStorm didn't complain about errors in code outside of my control, especially code that isn't actually in error.  Is there some setting I'm missing?  I tried marking node_modules as excluded, but that didn't help (and I don't know what other bad side effects that setting might have).

I think this error didn't actually show up until one day when I decided to browse inside node_modules to try to understand some module code.  Until then, perhaps WebStorm had been smart enough not to do code analysis inside there.
Comment actions Permalink

Files in javaScript libraries (and node_modules are addeds to libraries automatically) have the syntax highlighting level set to 'Syntax' (no inspections, just syntax errors from lexer)
You can change this level to 'None'. Unfortunately this can only be done on per file level (individually for each file). See

See also ( a possibility to exclude node_modules from libraries)

Comment actions Permalink

Thanks, that did the job.  It didn't have an immediate effect, but once I restarted WebStorm the error indication was gone.


Please sign in to leave a comment.