Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] the different output of run npm run command #6411

Open
2 tasks done
simo-an opened this issue May 1, 2023 · 0 comments
Open
2 tasks done

[BUG] the different output of run npm run command #6411

simo-an opened this issue May 1, 2023 · 0 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@simo-an
Copy link

simo-an commented May 1, 2023

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

the scripts in package is

  "scripts": {
    "test": "node index.js --PROJECT_ROOT $(pwd)"
  },

the index.js file content is

console.warn(process.argv)

i run two command in git bash of win10 os

  1. npm run test
    output
$ npm test

> test-command@1.0.0 test
> node index.js --PROJECT_ROOT $(pwd)

[
  'C:\\Program Files\\nodejs\\node.exe',
  'D:\\Test\\test-command\\index.js',
  '--PROJECT_ROOT',
  '$(pwd)'
]
  1. node index.js --PROJECT_ROOT $(pwd)
    output
$ node index.js --PROJECT_ROOT $(pwd)
[
  'C:\\Program Files\\nodejs\\node.exe',
  'D:\\Test\\test-command\\index.js',
  '--PROJECT_ROOT',
  'D:/Test/test-command'
]

Expected Behavior

two command output same result as last one

Steps To Reproduce

  1. create test project

index.js

console.warn(process.argv)

package.json

{
  "name": "test-command",
  "version": "1.0.0",
  "main": "index.js",
  "author": "June",
  "scripts": {
    "test": "node index.js --PROJECT_ROOT $(pwd)"
  }
}

  1. run command

run npm run test
run node index.js --PROJECT_ROOT $(pwd)

you will see the different result

Environment

  • npm: 9.6.5
  • Node.js: v16.14.2
  • OS Name: win10
  • System Model Name: dell xps 15
  • npm config:
$ npm config ls
; "user" config from C:\Users\june\.npmrc

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.14.2
; npm local prefix = D:\Test\test-gitcommand
; npm version = 9.6.5
; cwd = D:\Test\test-command
; HOME = C:\Users\june
; Run `npm config ls -l` to show all defaults.
@simo-an simo-an added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

1 participant