Skip to content

Conversation

alexsch01
Copy link
Contributor

[v10 branch]

Cherry-picks of
5d82d0b
5f18557
dd4cee9

splatteredbits and others added 3 commits September 5, 2025 14:38
Fixes issue #8468: npm.ps1 and npx.ps1 fail on Windows PowerShell 5.1 when run in strict mode.
improve the argument parsing PS1 logic
- support `& npm args` and `. npm args` properly
- support syntax such as `C:\"Program Files"\nodejs\npm.ps1 args`

**of course ^ for both npm and npx version of the script**

Code Explanation: instead of getting the `CommandElements.Extent.Text`
array and joining it with spaces right away, now it's getting the same
array and only capturing everything after the first element
@alexsch01 alexsch01 requested a review from a team as a code owner September 5, 2025 18:42
@alexsch01
Copy link
Contributor Author

alexsch01 commented Sep 17, 2025

NodeJS 24.8.0 includes this fix, working great

@alexsch01 alexsch01 changed the title fix(powershell): fix StrictMode and improve argument parsing [v10 backport] fix(powershell): fix StrictMode and improve argument parsing Sep 21, 2025
@alexsch01
Copy link
Contributor Author

Since NodeJS 22.x is not certain about npm 11 (nodejs/node#58423), we should get this into npm 10 series at some point @wraithgar

@alexsch01
Copy link
Contributor Author

@owlstronaut sorry to ping but can this get into v10 branch?

@wraithgar
Copy link
Member

@alexsch01 we hadn't forgotten about this, there are other PRs that were taking our attention and it didn't hurt to sit on this another few weeks to be extra sure things were working in latest.

@wraithgar wraithgar merged commit f7ff89c into npm:release/v10 Sep 30, 2025
23 checks passed
@alexsch01
Copy link
Contributor Author

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants