You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define package with package.json script that is executable in POSIX shell, but it is not executable/portable on cmd.exe.
2
Set script-shell configuration option in .npmrc in your package folder to "bash" (or "sh") to allow cross-platform execution of the script (Scripts will be cross platform as long as the target Windows machine has essential UNIX tools support, e.g. WSL or MSYS/Cygiwn installed).
Add a script with the following code or similar: NODE_OPTIONS='--max-old-space-size=8192' ./node_modules/jest/bin/jest
4
Run the script using "npm run", "pnpm run" on Windows system with "bash" available. Will work ok.
Run the script using "node --run". Script will fail with 'NODE_OPTIONS' is not recognized as an internal or external command, operable program or batch file.
How often does it reproduce? Is there a required condition?
N/A
What is the expected behavior? Why is that the expected behavior?
Node --run should work consistently with npm run, pnpm run, etc., in regards to which shell is used to run scripts.
What do you see instead?
See above - Scripts are always executed in default system shell, disregarding .npmrc script-shell option.
Additional information
No response
The text was updated successfully, but these errors were encountered:
@anonrig I was sort of expecting that answer - let me then just say (as a feedback to a feature being "in adoption") the way this was added, I am afraid node --run is IMO a mistake and will lead increase the existing huge headache of (non-)portability of npm scripts (that we struggle with in devops quite frequently). Thanks for reviewing this promptly tho!
Picking up some previous feedback I can confirm: #46534 (comment) <- noting that package managers actually do much more when running tasks
#46534 (comment) <- " if this is something that Deno already does, that’s a clear enough signal that Node could do it too", yes, but Deno uses cross-platform shell (similar to yarn and pnpm opt-in feature), not "default system shell" to execute scripts, which makes it much more usable.
Version
22
Platform
Subsystem
No response
What steps will reproduce the bug?
This is related to recently added feature #52190
1
Define package with package.json script that is executable in POSIX shell, but it is not executable/portable on cmd.exe.
2
Set script-shell configuration option in .npmrc in your package folder to "bash" (or "sh") to allow cross-platform execution of the script (Scripts will be cross platform as long as the target Windows machine has essential UNIX tools support, e.g. WSL or MSYS/Cygiwn installed).
2
Add a script with the following code or similar:
NODE_OPTIONS='--max-old-space-size=8192' ./node_modules/jest/bin/jest
4
Run the script using "npm run", "pnpm run" on Windows system with "bash" available. Will work ok.
Run the script using "node --run". Script will fail with
'NODE_OPTIONS' is not recognized as an internal or external command, operable program or batch file.
How often does it reproduce? Is there a required condition?
N/A
What is the expected behavior? Why is that the expected behavior?
Node --run should work consistently with npm run, pnpm run, etc., in regards to which shell is used to run scripts.
What do you see instead?
See above - Scripts are always executed in default system shell, disregarding .npmrc script-shell option.
Additional information
No response
The text was updated successfully, but these errors were encountered: