Skip to content

[BUG] npx loses quotations in command line arguments #2425

Closed
@highmtworks

Description

Current Behavior:

package.json

{
  "scripts": {
    "start": "ts-node index.ts"
  },
  "devDependencies": {
    "@types/node": "^14.14.16",
    "ts-node": "^9.1.1",
    "typescript": "^4.1.3"
  }
}

index.ts

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

then,

npx ts-node index.ts "a b"

and get

[ 'a', 'b' ]

Expected Behavior:

should print

[ 'a b' ]

In fact,

npm start "a b"

prints

[ 'a b' ]

Steps To Reproduce:

see Current Behavior section.

Environment:

  • OS: OS: Windows 10 Pro 2004 (19041.685)
  • Node: 15.5.0
  • npm: 7.3.0, 6.14.10

#2423 seems related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 releaseplatform:windowsis Windows-specific

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions