`npm rebuild --silent` is not silent

help-wanted
priority:low
cli
triaged
good-first-patch

(Mikkel Høgh) #1

What I Wanted to Do

In a testing script, I wanted to use the --silent option with npm rebuild to make the output readable.

What Happened Instead

npm does not respect the --silent or --quiet option when running npm rebuild --silent. It will instead output one line per rebuilt package.

Reproduction Steps

Run npm rebuild --silent or npm rebuild --quiet in any project with binary dependencies. I was using https://github.com/brianc/node-pg-cursor but any repo with binary deps should reproduce this.

Details

Bug report based on issue of the same title on Github

I’ve tested this with npm versions 3.10.10 and 6.4.1 with Node.js version 6, 8, and 10, all with the same result (lots of output instead of the desired silence).

Platform Info

I’ve reproduced this on macOS Mojave as well as inside the official Node.js Docker containers.

$ npm --versions
{ 'pg-cursor': '1.3.0',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.12.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.35',
  zlib: '1.2.11' }
$ node -p process.platform
darwin

(Lars Willighagen) #2

That’s output working (same thing with npm pack and a lot of other commands). @zkat Perhaps some custom loglevel-handling. Should output be notice, or equivalent to error?


(Kat Marchán) #3

yeah, we special-case silent in various places, and this seems like another good place to add it. I’ll tag it as such.