Join egghead, unlock knowledge.

Want more egghead? It's 45% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 45% Off

Already subscribed? Sign In

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

    Change the level of console output when running npm scripts

    Elijah ManorElijah Manor

    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.

    npmnpm
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss