Skip to content

[BUG] When run script loglevel is ignored unless set to "silent" #3354

@crystalfp

Description

@crystalfp

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Running any script by npm shows a log of the script execution even if it is not an error. For example:

npm run my-script --loglevel error

> [email protected] my-script D:\Project
> npx copyfiles --flat client/*.png server/http

The only way to silence the log message is by setting --loglevel silent

The problem is that setting loglevel in .npmrc silences also valid messages from npm. I had to spent too much time to debug why npm was not installing my application. Removing .npmrc revealed a version problem in my packages.

BTW this issue is a re-submission for npm@7 of #2468 for npm@6

Expected Behavior

If it is not an error, nothing should be shown by npm, only the script messages should appear.

Steps To Reproduce

  • Create a directory with a project in it
  • Edit package.json and add script "start": "node -e console.log('Hello')"
  • Run npm start. It shows the log
  • Run npm start --loglevel error. It show the log message, but it should not, it is not an error
  • Run npm start --loglevel silent. No log message.

Environment

  • OS: Windows 10 64bits
  • Node: 16.2.0
  • npm: 7.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority 2secondary priority issuecmd:run-scriptrelated to `npm run-script`config:displayIssues dealing with display of data to terminalsemver:majorbackwards-incompatible breaking changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions