Change the level of console output when running npm scripts

Elijah Manor
InstructorElijah Manor

Share this video with your friends

Send Tweet
Published 7 years ago
Updated 5 years ago

There are times when it is helpful for a npm script to have lots of logs when trying to debug a problem, but there are other times when you want to run a script silently. Thankfully there are a range of flags to control the log level used when running npm scripts.

Instructor: [00:02] When running npm scripts, you can pass a range of flags to control the level of log output. For example, we could pass loglevel silent, or instead we could just say, "--silent." For short, we could just say, "-s." You'll notice there's a lot less output in our terminal.

[00:22] The other logging options available, in shorthand form, are -q for quiet, -d for info, -dd for verbose, and -ddd for an extremely silly amount of logs.

[00:36] Let's run npm start again with -ddd. We get lots and lots of logs, which could be helpful if you're trying to track down a problem or you're trying to debug your scripts.