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.