Skip to content

[BUG] npm run erases script output after the final newline #8583

@mkantor

Description

@mkantor

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Any script which writes to standard output but does not emit a \n as its final character will have output erased when npm run exits.

Expected Behavior

npm run should never interfere with the output of scripts.

Steps To Reproduce

  1. Create a package.json file like this:
    {
      "name": "",
      "version": "0.0.0",
      "scripts": {
        "start": "printf 'this output will vanish'; sleep 3"
      }
    }
  2. Run npm run start.
  3. Observe that the output vanishes after three seconds.

Environment

  • npm -v: 11.6.0
  • node -v: v22.18.0
  • OS Name: macOS 15.6
  • System Model Name: MacBook Pro
  • npm config:
    //localhost:4873/:_authToken = (protected)
    //registry.npmjs.org/:_authToken = (protected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions