Skip to content

node shell shim missing in Windows installation node, required for WSL #43861

Closed as not planned
@hrishikesh-kadam

Description

@hrishikesh-kadam

What is the problem this feature will solve?

In the Windows installation of node, shell shim is missing which points to the node.exe required for using from WSL distros.

WSL Ubuntu 22.04 LTS
hrk@HRK-HPZBOOK:.../Program Files/nodejs$ pwd
/mnt/c/Program Files/nodejs

hrk@HRK-HPZBOOK:.../Program Files/nodejs$ \ls -alFh
total 62M
dr-xr-xr-x 1 hrk hrk 4.0K Jul 16 21:18 ./
dr-xr-xr-x 1 hrk hrk 4.0K Jul 16 16:46 ../
-r-xr-xr-x 1 hrk hrk  322 Jul 16 20:27 corepack*
-r-xr-xr-x 1 hrk hrk  218 Jul  8 06:00 corepack.cmd*
-r-xr-xr-x 1 hrk hrk 3.0K Jul  8 06:00 install_tools.bat*
-r-xr-xr-x 1 hrk hrk 8.8K Oct 14  2021 node_etw_provider.man*
-r-xr-xr-x 1 hrk hrk  62M Jul 13 14:32 node.exe*
dr-xr-xr-x 1 hrk hrk 4.0K Jul 16 16:34 node_modules/
-r-xr-xr-x 1 hrk hrk  702 Oct 14  2021 nodevars.bat*
-r-xr-xr-x 1 hrk hrk 1.4K Jul 16 20:27 npm*
-r-xr-xr-x 1 hrk hrk  483 Jul  7 06:00 npm.cmd*
-r-xr-xr-x 1 hrk hrk 1.6K Jul 16 20:27 npx*
-r-xr-xr-x 1 hrk hrk  539 Jul  7 06:00 npx.cmd*

hrk@HRK-HPZBOOK:.../Program Files/nodejs$ node --version
-bash: /mnt/c/Program Files/nodejs/node: No such file or directory

hrk@HRK-HPZBOOK:.../Program Files/nodejs$ node.exe --version
v18.6.0

Git Bash can run the node --version command without appending .exe to the node as expected.

Git Bash
hrkad@HRK-HPZBOOK MINGW64 /c/Program Files/nodejs
$ node --version
v18.6.0

hrkad@HRK-HPZBOOK MINGW64 /c/Program Files/nodejs
$ node.exe --version
v18.6.0

What is the feature you are proposing to solve the problem?

There are two ways to solve this issue.

  1. By creating shell shim node passing arguments to node.exe
WSL Ubuntu 22.04 LTS -> Run as administrator
hrk@HRK-HPZBOOK:.../Program Files/nodejs$ cat > node <<EOL
#!/bin/sh
node.exe "\$@"
EOL

hrk@HRK-HPZBOOK:.../Program Files/nodejs$ cat node
#!/bin/sh
node.exe "$@"

hrk@HRK-HPZBOOK:.../Program Files/nodejs$ node --version
v18.6.0
  1. By creating a symlink node pointing to node.exe
Command Prompt -> Run as administrator
C:\Program Files\nodejs>mklink node node.exe
symbolic link created for node <<===>> node.exe

C:\Program Files\nodejs>dir
 Volume in drive C is Windows
 Volume Serial Number is XXXX-XXXX

 Directory of C:\Program Files\nodejs

16/07/2022  09:48 PM    <DIR>          .
16/07/2022  04:46 PM    <DIR>          ..
16/07/2022  08:27 PM               322 corepack
08/07/2022  06:00 AM               218 corepack.cmd
08/07/2022  06:00 AM             3,033 install_tools.bat
16/07/2022  09:48 PM    <SYMLINK>      node [node.exe]
13/07/2022  02:32 PM        64,891,000 node.exe
14/10/2021  12:30 AM               702 nodevars.bat
14/10/2021  12:30 AM             8,997 node_etw_provider.man
16/07/2022  04:34 PM    <DIR>          node_modules
16/07/2022  08:27 PM             1,365 npm
07/07/2022  06:00 AM               483 npm.cmd
16/07/2022  08:27 PM             1,567 npx
07/07/2022  06:00 AM               539 npx.cmd
              11 File(s)     64,908,226 bytes
               3 Dir(s)  252,773,011,456 bytes free
WSL Ubuntu 22.04 LTS
hrk@HRK-HPZBOOK:.../Program Files/nodejs$ node --version
v18.6.0

What alternatives have you considered?

Installing node natively on WSL obviously solves the issue but it causes double dependencies of the core software and global packages, one on Windows and the other inside WSL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.stalewindowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions