[npm & Bower] npm run-script 実行時の npm ERR! を非表示にしたい

オプションを付けて実行するか、.npmrc に設定を書く。

症状

lint を実行したけれど、npm ERR! があって可読性が落ちる。

% npm run-script lint
> bp-middleman@0.2.5 lint /Users/****/projects/bp-middleman
> npm run lint:css && npm run lint:html && npm run lint:js
> bp-middleman@0.2.5 lint:css /Users/****/projects/bp-middleman
> bundle exec scss-lint
source/stylesheets/foundations/_typography.scss:233 [W] ColorVariable: Color literals like `#eee` should only be used in variable declarations; they should be referred to via variable everywhere else.
source/stylesheets/foundations/_typography.scss:244 [W] ColorVariable: Color literals like `#ccc` should only be used in variable declarations; they should be referred to via variable everywhere else.
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/6.1.0/bin/node" "/usr/local/bin/npm" "run" "lint:css"
npm ERR! node v6.1.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
    :

対応

CLI からの実行時に -s, --silent: --loglevel silent オプションを付ける。

% npm run-script --silent lint
source/stylesheets/foundations/_typography.scss:233 [W] ColorVariable: Color literals like `#eee` should only be used in variable declarations; they should be referred to via variable everywhere else.
source/stylesheets/foundations/_typography.scss:244 [W] ColorVariable: Color literals like `#ccc` should only be used in variable declarations; they should be referred to via variable everywhere else.

.npmrc に設定する場合。-s オプションなしで同じ振る舞いとなる。

~/.npmrc
loglevel=silent