How do I suppress the version banner from npm output?

OS: Windows 10
Node: 10.13.0
npm: 6.4.1

I run some npm commands during our CI automation and I noticed today that npm sometimes spits out a big annoying banner about upgrading:

> npm config get registry
   โ”‚                                                               โ”‚
   โ”‚       New minor version of npm available! 6.4.1 โ†’ 6.5.0       โ”‚
   โ”‚   Changelog:   โ”‚
   โ”‚               Run npm install -g npm to update!               โ”‚
   โ”‚                                                               โ”‚

This messes with automation that is expecting the output of the command to be just the normal output. Is there a command-line flag or config option for suppressing this banner?

Also, I tried doing this myself via head but ran into an issue there too:

$ npm config get registry | head -n 1
npm ERR! code EPIPE
npm ERR! errno EPIPE
npm ERR! syscall write
npm ERR! EPIPE: broken pipe, write

Why is this happening? This doesnโ€™t happen with yarn or any other tool we use.

You can use --update-notifier=false or --no-update-notifier, or use that option in a .npmrc or a environment variable.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.