Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

304
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda