Change the level of console output when running npm scripts

Elijah Manor
InstructorElijah Manor
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 6 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.

egghead
egghead
~ 13 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today