npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.49k stars 3.17k forks source link

[BUG] Single -- separator fails to pass arguments to npm script in version 10.9.0 #7880

Closed leebailey88 closed 2 weeks ago

leebailey88 commented 2 weeks ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

Instead of executing the mtm script with the specified arguments, npm outputs the current version (10.9.0) and exits.

Workaround

npm run mtm -- -- -l 1 -s 0 -h 160000 -f vix/vix-ta-macro-advanced --vix --bci --seasonal --cpi --effr --bond10 --bond2 --aaii --m2 --cape --fileToSheetName -v

Expected Behavior

Running the following command should execute the mtm script in package.json with the provided arguments:

npm run mtm -- -l 1 -s 0 -h 160000 -f vix/vix-ta-macro-advanced --vix --bci --seasonal --cpi --effr --bond10 --bond2 --aaii --m2 --cape --fileToSheetName -v```

### Steps To Reproduce

### Steps to Reproduce
1. Create an `mtm` script in `package.json`:
   ```json
   {
     "scripts": {
       "mtm": "node path/to/your-script.js"
     }
   }
  1. Run the command with arguments after a single -- separator:
    npm run mtm -- -l 1 -s 0 -h 160000 -f vix/vix-ta-macro-advanced --vix --bci --seasonal --cpi --effr --bond10 --bond2 --aaii --m2 --cape --fileToSheetName -v
  2. Observe that npm prints its version instead of executing the script with the arguments.

Additional Notes

This behavior change only started after upgrading to npm 10.9.0; the command worked correctly on 10.8.0. This change may be a bug or a new feature, but it’s currently undocumented.

Environment

Environment

milaninfy commented 2 weeks ago

Are you running in powershell? --- is also valid as far as i know. This is powershell behaviour.

milaninfy commented 2 weeks ago

Closing: this looks to be similar if not a duplicate of an existing issue, 7375. If you believe your instance is unique, please provide further clarifying details.