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.

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.

2 participants