Skip to content

Conversation

@HariniMalothu17
Copy link
Contributor

@HariniMalothu17 HariniMalothu17 commented Jan 15, 2026

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

  • Bug fix (non-breaking change which fixes an issue)

Why

  • The script requests version 22.14.0 from OpenJS.NodeJS.LTS, but this is a rolling package that now only contains 24.x versions (22.14.0 exists in OpenJS.NodeJS.22, not .LTS)
  • After installing tools via winget, the PATH isn't refreshed in the current session, so validation fails
  • Winget returns non-zero exit codes for valid scenarios like "already installed", which the script treats as failure

Resolves [Add Relevant Issue Here]

What

  • Removed hardcoded Node.js version - Now installs latest LTS instead of a specific version that may not exist
  • Added PATH refresh after winget install - Newly installed tools are immediately available without restarting the terminal
  • Added re-validation after install - Checks if the tool actually works instead of relying solely on winget's exit code

Screenshots

image

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

@HariniMalothu17 HariniMalothu17 requested review from a team as code owners January 15, 2026 10:20
Copy link
Contributor

@vineethkuttan vineethkuttan left a 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

image

Tags = @('appDev');
Valid = { CheckNode; }
Install = { WinGetInstall OpenJS.NodeJS.LTS "22.14.0" };
Install = { WinGetInstall OpenJS.NodeJS.LTS };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://endoflife.date/nodejs

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")
Copy link
Contributor

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.

Copy link
Contributor Author

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

@HariniMalothu17
Copy link
Contributor Author

You have to change the in samples and update the website https://microsoft.github.io/react-native-windows/docs/rnw-dependencies

image

microsoft/react-native-windows-samples#1132
I have raised pr to update in documentation

Copy link
Contributor

@iamAbhi-916 iamAbhi-916 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@iamAbhi-916
Copy link
Contributor

You have to change the in samples and update the website https://microsoft.github.io/react-native-windows/docs/rnw-dependencies

image

Is this done?

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