-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix rnw-dependencies.ps1 Node.js installation failures #15548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix rnw-dependencies.ps1 Node.js installation failures #15548
Conversation
vineethkuttan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to change the in samples and update the website
https://microsoft.github.io/react-native-windows/docs/rnw-dependencies
vnext/Scripts/rnw-dependencies.ps1
Outdated
| Tags = @('appDev'); | ||
| Valid = { CheckNode; } | ||
| Install = { WinGetInstall OpenJS.NodeJS.LTS "22.14.0" }; | ||
| Install = { WinGetInstall OpenJS.NodeJS.LTS }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node 22's latest version updated to 22.22.0
removing version will install node 24 I believe, because that is the latest LTS.
replace 22.14.0 with 22.22.0
| } | ||
|
|
||
| # Refresh PATH environment variable to pick up newly installed tools | ||
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not needed I guess, cause the script is designed in a way to close the terminal after it finishes.
So refreshing path is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PATH refresh is needed because re-validation code calls Invoke-Command $req.Valid during the same script session.
For example, CheckNode uses Get-Command node which relies on the current $env:Path. Without refreshing PATH after winget install, the re-validation will fail even though Node.js was successfully installed.
The "close terminal" message at the end is for other applications that need the new PATH. But for the script's own validation to work, we need the refresh
microsoft/react-native-windows-samples#1132 |
iamAbhi-916
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Is this done? |


Description
The rnw-dependencies.ps1 script fails to install Node.js with the error:
WARNING: There was a problem trying to install Node.js (LTS, >= 22.0)Type of Change
Why
OpenJS.NodeJS.LTS, but this is a rolling package that now only contains 24.x versions (22.14.0 exists inOpenJS.NodeJS.22, not.LTS)Resolves [Add Relevant Issue Here]
What
Screenshots
Testing
tested on a new vm .Worked as expected
Changelog
Should this change be included in the release notes: no
Add a brief summary of the change to use in the release notes for the next release.
Microsoft Reviewers: Open in CodeFlow