Chooce video playback speed
speed:1

Change the level of console output when running npm scripts

InstructorElijah Manor

Share this video with your friends

Send Tweet

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: 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.

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.

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.