npm / npm/cli

[BUG] "script": "echo 'hi'" prints differently on macOS and windows

Open
#6,968 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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
{
  "name": "hi",
  "scripts": {
    "build": "echo 'hi'"
  }
}

On macOS, this prints:


> build
> echo "hi"

hi

In Windows GitBash, it prints


> build
> echo "hi"

'hi'
Expected Behavior

I would expect both Windows and macOS to print the same output

Steps To Reproduce

See above

Environment
  • npm: 9.8.1
  • Node.js: 18.18.0
  • OS Name: macOS and Windows 10
  • System Model Name:
  • npm config:
; "user" config from /Users/mehulkar/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /Users/mehulkar/.nvm/versions/node/v18.18.0/bin/node
; node version = v18.18.0
; npm local prefix = /Users/mehulkar/dev/vercel/playground/npmrun
; npm version = 9.8.1
; cwd = /Users/mehulkar/dev/vercel/playground/npmrun
; HOME = /Users/mehulkar
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing npm run build with the shown script on macOS and Windows Git Bash, then trace npm's script execution and output handling across both environments. Done means the command produces equivalent output on both platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.