Skip to content

build: add shim to call node from wsl - #63101

Open
nadalaba wants to merge 1 commit into
nodejs:mainfrom
nadalaba:wsl-shim
Open

build: add shim to call node from wsl#63101
nadalaba wants to merge 1 commit into
nodejs:mainfrom
nadalaba:wsl-shim

Conversation

@nadalaba

@nadalaba nadalaba commented May 3, 2026

Copy link
Copy Markdown
Contributor

On Windows installation of node.exe, WSL shells cannot call node without the extension .exe.
This PR adds a minimal shim to the installation directory that calls the main binary node.exe
Resolves conflicts from and closes #43948

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. install Issues and PRs related to the installers. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform. labels May 3, 2026
Comment thread tools/msvs/shims/node
Signed-off-by: Nad Alaba <37968805+nadalaba@users.noreply.github.com>
@StefanStojanovic

Copy link
Copy Markdown
Contributor

The change looks OK to me. Before approving, I have one question: was this validated, and if so, how?

@nadalaba

Copy link
Copy Markdown
Contributor Author

@StefanStojanovic well node works from wsl without appending .exe now, so I'd say it's validated

@StefanStojanovic

Copy link
Copy Markdown
Contributor

That's good, but there are a few more things that could be validated.

For example, run node -p 'process.execPath' from WSL and validate that it points to the intended node.exe. Run where node(cmd)/Get-Command node -All(PowerShell) from the Windows shell to make sure the shin doesn't affect node resolution on Windows (can also run node -p 'process.execPath'). You could also check npm --version; since npm uses node, it should work as well.

The second thing that is worth validating is the MSI installer. Playing with it: install it, repair the installation after deleting the shim manually, upgrade to a new version, and uninstall. These should all work as expected (adding/removing the shim when expected).

While I believe all of these things will work as expected, I'd still like you to try them to make sure all is as it should be.

@nadalaba

Copy link
Copy Markdown
Contributor Author

@StefanStojanovic Thanks for the suggestions.

Yes, node resolution works as expected from all shells I tested: cmd, powershell, wsl, msys2, git bash.
where node behaves weirdly from cmd, putting node before node.exe, but that's just because the system32 where.exe utility is drunk. In reality, when node is invoked from cmd, node.exe takes priority over plain node. This happens with all shims (npm/npm.cmd/npm.ps1 for example).

All msi operations (install/uninstall/repair/upgrade to a newer version) work as expected regarding the shim.

If you're interested in getting windows‑node to behave correctly with WSL, #63118 might be relevant. Could you take a look at it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to build files or the CI. install Issues and PRs related to the installers. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants