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] npm run: '--' prefixed flags invalid #6541

Closed
2 tasks done
JerryWn12 opened this issue Jun 8, 2023 · 5 comments
Closed
2 tasks done

[BUG] npm run: '--' prefixed flags invalid #6541

JerryWn12 opened this issue Jun 8, 2023 · 5 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

@JerryWn12
Copy link

JerryWn12 commented Jun 8, 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 arguments start with '--' won't pass to program when using npm run --
main.js
console.log(process.argv)
commands:
npm run start -- --test=text
output:
(won't show --test=text argument)
screenshot:
screenshot

Expected Behavior

the argument start with '--' should output normally

[
  'C:\\Users\\user\\AppData\\Local\\Programs\\node-v18.16.0-win-x64\\node.exe',
  'C:\\Users\\user\\WorkSpace\\test\\src\\main.js',
  '--test=text'
]

Steps To Reproduce

  1. latest vscode, nodejs lts v18.16.0, npm v9.7.1
  2. create file structure in screenshot above
  3. open terminal, run npm run start -- --arg=value
  4. won't see value in output

Environment

  • npm: v9.7.1
  • Node.js: v18.16.0 lts
  • OS Name: Windows 11 22H2 22621.1778
  • System Model Name: Lenovo
  • npm config:
; "user" config from C:\Users\user\.npmrc

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

; node bin location = C:\Users\user\AppData\Local\Programs\node-v18.16.0-win-x64\node.exe
; node version = v18.16.0
; npm local prefix = C:\Users\user
; npm version = 9.7.1
; cwd = C:\Users\user
; HOME = C:\Users\user
; Run `npm config ls -l` to show all defaults.
@JerryWn12 JerryWn12 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 Jun 8, 2023
@JerryWn12
Copy link
Author

JerryWn12 commented Jun 8, 2023

update npm to 9.7.1 fixes it
it still happen

npm run start -- --test=text

> test@1.0.0 start
> node main.js

[
  'C:\\Users\\user\\AppData\\Local\\Programs\\node-v18.16.0-win-x64\\node.exe',
  'C:\\Users\\user\\WorkSpace\\test\\main.js'
]
npm -v
9.7.1

@JerryWn12 JerryWn12 reopened this Jun 8, 2023
@JerryWn12
Copy link
Author

behave normally when argument don't start with '--'

npm run start -- test=text  

> test@1.0.0 start
> node main.js test=text

[
  'C:\\Users\\user\\AppData\\Local\\Programs\\node-v18.16.0-win-x64\\node.exe',
  'C:\\Users\\user\\WorkSpace\\test\\main.js',
  'test=text'
]

@shadowspawn
Copy link
Contributor

Are you running the command from PowerShell?

Possibly related: #3136

@JerryWn12
Copy link
Author

Are you running the command from PowerShell?

Possibly related: #3136

yes, it's powershell
thank you for help, i'll use solution in that thread

@AlexandreNS
Copy link

I'm having to use -- twice, like this:

npm run start -- -- --some-parameter

Any solution implemented without use this trick in powershell?

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

3 participants