Skip to content

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

Closed

Description

@crystalfp

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 same problem appears with npm@7
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@7 was not installing my application. Removing .npmrc revealed a version problem in my packages.

Expected Behavior:

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

Steps To Reproduce:

  1. Create a project
  2. Edit package.json and change the start script to "node -e console.log(\"Hello\")"
  3. Run npm start It show the log
  4. Run npm start --loglevel error It show the log message
  5. Run npm start --loglevel silent No log message and the script output appears.'

Environment:

  • OS: Windows 10 64bits and Ubuntu latest
  • Node: 14.15.1 and 15.5.1
  • npm: 6.4.8 and 7.4.0

Activity

  1. added
    Bug
    Needs Triage
    Release 6.x
    on Jan 10, 2021
  2. removed
    Needs Triage
    on Feb 13, 2021
  3. darcyclarke commented on Jun 2, 2021

    @darcyclarke
    Contributor

    npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

    If your bug is preproducible on v7, please re-file this issue using our new issue template.

    If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugRelease 6.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions