- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.8k
 
Open
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 releasework is associated with a specific npm 9 release
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
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
- npm run test
output 
$ npm test
> [email protected] test
> node index.js --PROJECT_ROOT $(pwd)
[
  'C:\\Program Files\\nodejs\\node.exe',
  'D:\\Test\\test-command\\index.js',
  '--PROJECT_ROOT',
  '$(pwd)'
]
- 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
- 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)"
  }
}
- 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.Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 releasework is associated with a specific npm 9 release