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 start ignores empty argument on windows #2249

Closed
highmtworks opened this issue Nov 27, 2020 · 5 comments
Closed

[BUG] npm start ignores empty argument on windows #2249

highmtworks opened this issue Nov 27, 2020 · 5 comments
Labels
Bug thing that needs fixing platform:windows is Windows-specific Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@highmtworks
Copy link

Current Behavior:

package.json

{
  "scripts": {
    "start": "node index.js"
  }
}

index.js

console.log(process.argv.slice(2));

then,

npm start -- a "" b

npm 6.14.9, 7.0.11 prints

[ 'a', '', 'b' ]

but npm 7.0.12 - 7.0.14 prints

[ 'a', 'b' ]

Expected Behavior:

should be

[ 'a', '', 'b' ]

Steps To Reproduce:

see Current Behavior section

Environment:

  • OS: Windows 10 Pro 2004 (19041.630)
  • Node: 15.13.0
  • npm: 7.0.14

maybe caused by

const children = child.contents.filter(segment => segment !== null).map(segment => quoteForShell(segment, false, isWindows && 'win32'))

@highmtworks highmtworks added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Nov 27, 2020
@darcyclarke darcyclarke added platform:windows is Windows-specific and removed Needs Triage needs review for next steps labels Jan 29, 2021
@darcyclarke
Copy link
Contributor

@highmtworks can you try updating to the latest v7 (ie. npm i -g npm@7) & try reproducing this?

@highmtworks
Copy link
Author

Thank you for the response.
It still happens:

>npm --version
7.5.0

>node --version
v15.7.0

>npm start -s -- a "" b
[ 'a', 'b' ]

@highmtworks
Copy link
Author

>npm --version
7.5.2

>node --version
v15.8.0

>npm start -s -- a "" b
[ 'a', 'b' ]

@ljharb ljharb added the Needs Triage needs review for next steps label Feb 3, 2021
@darcyclarke darcyclarke added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Feb 5, 2021
@highmtworks
Copy link
Author

I created npm/run-script#20 .
I hope it resolves this.

@wraithgar
Copy link
Member

Closed by npm/run-script#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing platform:windows is Windows-specific Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

4 participants