Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

300
Views
Why aren't NPM scripts relaying arguments correctly on Windows PowerShell?

Been vexed by this all day. Using Powershell 7.2

Given script index.js with this single line

console.log(process.argv);

And a package.json of

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

When I invoke this command:

node index -a -b -c

Then I see

[
  'C:\\nodejs\\node.exe',
  'C:\\Users\\michael.morris\\Projects\\Fleetcor\\ucx-cucumber\\index.js',
  '-a',
  '-b',
  '-c'
]

And when I run

npm run index -- -a -b -c

Then I should get the same output, but I don't. The -a -b -c args are gone. The -- should prevent that.

This really sucks. I have to be doing something wrong right?

Node v14.15.5, NPM 8.1.3

EDIT: The mystery deepens. I decided to try this across different shells. The above behavior was on PowerShell 7.2 running stand alone since I don't have admin permissions on this machine. I tried PS 5 which came with the machine, same problem. So I went to the command prompt - and it worked as it should...

So I can proceed with my work, but it would help to know exactly what's up or if this is a bug of some sort.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!