Windows Subsystem for Linux (WSL) using shared Node.js installation with Windows: Node.js npm & npx...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have recently moved to a Windows + WSL environment (WSL is going very good by the way). The main reason of doing this is to have a Linux environment for development and having Windows for other apps & games without having to reboot my computer (had a dual-boot setup before).



In the setup process, I found most of the Windows installed binaries can be executed from WSL. So instead of duplicating installations (eg: installing java and maven in Windows in order to use Eclipse IDE and then installing it in WSL separately to use it in the terminal) I could just install java jdk in Windows and symlink the binaries to WSL in order to share the jdk installation, this worked flawlessly). But doing the same with node, happens that node npm and npx binaries are not working :(



I wannted to have a single node installation which I could manage using using nvm windows. So I started the installation the following way:



In WSL, I configured my /etc/wsl.conf, following Nick Janetakis guide here (thanks Nick) in order to mount Windows drives at / instead of /mnt/:



/etc/wsl.conf



[automount]
root = /
options = "metadata"


Then installed node in windows:



C:Windowssystem32> nvm install 10.15.0
... installing process...
C:Windowssystem32> nvm use 10.15.0
...success message...
C:Windowssystem32> node -v
v10.15.0
C:Windowssystem32> npm -v
6.4.1


Everything working as expected so far. The next step is to symlink the windows node binaries to WSL. The binaries are located at:



C:Windowssystem32> where node
C:Program Filesnodejsnode.exe

C:Windowssystem32> where npm
C:Program Filesnodejsnpm
C:Program Filesnodejsnpm.cmd

C:Windowssystem32>where npx
C:Program Filesnodejsnpx
C:Program Filesnodejsnpx.cmd


So inside WSL terminal (remember that my disks are mounted at /c not /mnt/c as the default behaviour):



user@host:~$ mkdir ~/bin
user@host:~$ ln -s /c/Program Files/nodejs/node.exe ~/bin/node
user@host:~$ ln -s /c/Program Files/nodejs/npm ~/bin/npm
user@host:~$ ln -s /c/Program Files/nodejs/npx ~/bin/npx


And...



user@host:/d/tmp$ node -v
v10.15.0
user@host:/d/tmp$ echo "console.log('Hello World');" >> index.js
user@host:/d/tmp$ node index.js
Hello World


Great! (Note: as node is installed on windows, when being on WSL you must use it inside a disk drive, /d in this case). But...



user@host:~$ npm -v
internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module 'C:homeuserbinnode_modulesnpmbinnpm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)


Now that's the reason I'm writing this. The error is clear, npm is trying to find npm-cli.js in a path which is a wired mix of the npm symlink location inside a windows path.



Is there a way to tell npm/npx the correct Windows path where it must find its files from WSL?



Sorry for the long question but due to the very particular setup I considered that contextualization necessary.










share|improve this question































    0















    I have recently moved to a Windows + WSL environment (WSL is going very good by the way). The main reason of doing this is to have a Linux environment for development and having Windows for other apps & games without having to reboot my computer (had a dual-boot setup before).



    In the setup process, I found most of the Windows installed binaries can be executed from WSL. So instead of duplicating installations (eg: installing java and maven in Windows in order to use Eclipse IDE and then installing it in WSL separately to use it in the terminal) I could just install java jdk in Windows and symlink the binaries to WSL in order to share the jdk installation, this worked flawlessly). But doing the same with node, happens that node npm and npx binaries are not working :(



    I wannted to have a single node installation which I could manage using using nvm windows. So I started the installation the following way:



    In WSL, I configured my /etc/wsl.conf, following Nick Janetakis guide here (thanks Nick) in order to mount Windows drives at / instead of /mnt/:



    /etc/wsl.conf



    [automount]
    root = /
    options = "metadata"


    Then installed node in windows:



    C:Windowssystem32> nvm install 10.15.0
    ... installing process...
    C:Windowssystem32> nvm use 10.15.0
    ...success message...
    C:Windowssystem32> node -v
    v10.15.0
    C:Windowssystem32> npm -v
    6.4.1


    Everything working as expected so far. The next step is to symlink the windows node binaries to WSL. The binaries are located at:



    C:Windowssystem32> where node
    C:Program Filesnodejsnode.exe

    C:Windowssystem32> where npm
    C:Program Filesnodejsnpm
    C:Program Filesnodejsnpm.cmd

    C:Windowssystem32>where npx
    C:Program Filesnodejsnpx
    C:Program Filesnodejsnpx.cmd


    So inside WSL terminal (remember that my disks are mounted at /c not /mnt/c as the default behaviour):



    user@host:~$ mkdir ~/bin
    user@host:~$ ln -s /c/Program Files/nodejs/node.exe ~/bin/node
    user@host:~$ ln -s /c/Program Files/nodejs/npm ~/bin/npm
    user@host:~$ ln -s /c/Program Files/nodejs/npx ~/bin/npx


    And...



    user@host:/d/tmp$ node -v
    v10.15.0
    user@host:/d/tmp$ echo "console.log('Hello World');" >> index.js
    user@host:/d/tmp$ node index.js
    Hello World


    Great! (Note: as node is installed on windows, when being on WSL you must use it inside a disk drive, /d in this case). But...



    user@host:~$ npm -v
    internal/modules/cjs/loader.js:583
    throw err;
    ^

    Error: Cannot find module 'C:homeuserbinnode_modulesnpmbinnpm-cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)


    Now that's the reason I'm writing this. The error is clear, npm is trying to find npm-cli.js in a path which is a wired mix of the npm symlink location inside a windows path.



    Is there a way to tell npm/npx the correct Windows path where it must find its files from WSL?



    Sorry for the long question but due to the very particular setup I considered that contextualization necessary.










    share|improve this question



























      0












      0








      0


      1






      I have recently moved to a Windows + WSL environment (WSL is going very good by the way). The main reason of doing this is to have a Linux environment for development and having Windows for other apps & games without having to reboot my computer (had a dual-boot setup before).



      In the setup process, I found most of the Windows installed binaries can be executed from WSL. So instead of duplicating installations (eg: installing java and maven in Windows in order to use Eclipse IDE and then installing it in WSL separately to use it in the terminal) I could just install java jdk in Windows and symlink the binaries to WSL in order to share the jdk installation, this worked flawlessly). But doing the same with node, happens that node npm and npx binaries are not working :(



      I wannted to have a single node installation which I could manage using using nvm windows. So I started the installation the following way:



      In WSL, I configured my /etc/wsl.conf, following Nick Janetakis guide here (thanks Nick) in order to mount Windows drives at / instead of /mnt/:



      /etc/wsl.conf



      [automount]
      root = /
      options = "metadata"


      Then installed node in windows:



      C:Windowssystem32> nvm install 10.15.0
      ... installing process...
      C:Windowssystem32> nvm use 10.15.0
      ...success message...
      C:Windowssystem32> node -v
      v10.15.0
      C:Windowssystem32> npm -v
      6.4.1


      Everything working as expected so far. The next step is to symlink the windows node binaries to WSL. The binaries are located at:



      C:Windowssystem32> where node
      C:Program Filesnodejsnode.exe

      C:Windowssystem32> where npm
      C:Program Filesnodejsnpm
      C:Program Filesnodejsnpm.cmd

      C:Windowssystem32>where npx
      C:Program Filesnodejsnpx
      C:Program Filesnodejsnpx.cmd


      So inside WSL terminal (remember that my disks are mounted at /c not /mnt/c as the default behaviour):



      user@host:~$ mkdir ~/bin
      user@host:~$ ln -s /c/Program Files/nodejs/node.exe ~/bin/node
      user@host:~$ ln -s /c/Program Files/nodejs/npm ~/bin/npm
      user@host:~$ ln -s /c/Program Files/nodejs/npx ~/bin/npx


      And...



      user@host:/d/tmp$ node -v
      v10.15.0
      user@host:/d/tmp$ echo "console.log('Hello World');" >> index.js
      user@host:/d/tmp$ node index.js
      Hello World


      Great! (Note: as node is installed on windows, when being on WSL you must use it inside a disk drive, /d in this case). But...



      user@host:~$ npm -v
      internal/modules/cjs/loader.js:583
      throw err;
      ^

      Error: Cannot find module 'C:homeuserbinnode_modulesnpmbinnpm-cli.js'
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
      at Function.Module._load (internal/modules/cjs/loader.js:507:25)
      at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)


      Now that's the reason I'm writing this. The error is clear, npm is trying to find npm-cli.js in a path which is a wired mix of the npm symlink location inside a windows path.



      Is there a way to tell npm/npx the correct Windows path where it must find its files from WSL?



      Sorry for the long question but due to the very particular setup I considered that contextualization necessary.










      share|improve this question
















      I have recently moved to a Windows + WSL environment (WSL is going very good by the way). The main reason of doing this is to have a Linux environment for development and having Windows for other apps & games without having to reboot my computer (had a dual-boot setup before).



      In the setup process, I found most of the Windows installed binaries can be executed from WSL. So instead of duplicating installations (eg: installing java and maven in Windows in order to use Eclipse IDE and then installing it in WSL separately to use it in the terminal) I could just install java jdk in Windows and symlink the binaries to WSL in order to share the jdk installation, this worked flawlessly). But doing the same with node, happens that node npm and npx binaries are not working :(



      I wannted to have a single node installation which I could manage using using nvm windows. So I started the installation the following way:



      In WSL, I configured my /etc/wsl.conf, following Nick Janetakis guide here (thanks Nick) in order to mount Windows drives at / instead of /mnt/:



      /etc/wsl.conf



      [automount]
      root = /
      options = "metadata"


      Then installed node in windows:



      C:Windowssystem32> nvm install 10.15.0
      ... installing process...
      C:Windowssystem32> nvm use 10.15.0
      ...success message...
      C:Windowssystem32> node -v
      v10.15.0
      C:Windowssystem32> npm -v
      6.4.1


      Everything working as expected so far. The next step is to symlink the windows node binaries to WSL. The binaries are located at:



      C:Windowssystem32> where node
      C:Program Filesnodejsnode.exe

      C:Windowssystem32> where npm
      C:Program Filesnodejsnpm
      C:Program Filesnodejsnpm.cmd

      C:Windowssystem32>where npx
      C:Program Filesnodejsnpx
      C:Program Filesnodejsnpx.cmd


      So inside WSL terminal (remember that my disks are mounted at /c not /mnt/c as the default behaviour):



      user@host:~$ mkdir ~/bin
      user@host:~$ ln -s /c/Program Files/nodejs/node.exe ~/bin/node
      user@host:~$ ln -s /c/Program Files/nodejs/npm ~/bin/npm
      user@host:~$ ln -s /c/Program Files/nodejs/npx ~/bin/npx


      And...



      user@host:/d/tmp$ node -v
      v10.15.0
      user@host:/d/tmp$ echo "console.log('Hello World');" >> index.js
      user@host:/d/tmp$ node index.js
      Hello World


      Great! (Note: as node is installed on windows, when being on WSL you must use it inside a disk drive, /d in this case). But...



      user@host:~$ npm -v
      internal/modules/cjs/loader.js:583
      throw err;
      ^

      Error: Cannot find module 'C:homeuserbinnode_modulesnpmbinnpm-cli.js'
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
      at Function.Module._load (internal/modules/cjs/loader.js:507:25)
      at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)


      Now that's the reason I'm writing this. The error is clear, npm is trying to find npm-cli.js in a path which is a wired mix of the npm symlink location inside a windows path.



      Is there a way to tell npm/npx the correct Windows path where it must find its files from WSL?



      Sorry for the long question but due to the very particular setup I considered that contextualization necessary.







      node.js ubuntu npm windows-10 windows-subsystem-for-linux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 at 18:56







      Sebastian Duque

















      asked Jan 4 at 7:02









      Sebastian DuqueSebastian Duque

      11816




      11816
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I have my own development environment, so I couldn't test it on the same environment of yours.
          But, I suggest that you should check whether npm under "Program Files" works well on WSL.



          user@host:~$ /c/Program Files/nodejs/npm -v


          In my case, another error occurs when running above command.



          Error: EINVAL: invalid argument, uv_pipe_open


          If it is the same on your environment, you may solve this issue first.



          And, about module path issue, it seems to be caused by path; the original npm(under Program Files) and your symbolic link have different current path.



          I modified the original npm as below:



          #!/bin/sh
          (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

          basedir=`dirname "$0"`

          echo $basedir # Added code

          case `uname` in
          *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
          esac
          ...


          If you run the original npm and your symbolic link, $basedir will shows different results, and it causes module path issue.



          If you can solve the first issue(uv_pipe_open error), how about adding the nodejs directory on your path instead of symbolic links?






          share|improve this answer
























          • And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

            – Anselmo Park
            Jan 4 at 9:30











          • I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

            – Sebastian Duque
            Jan 4 at 19:06











          • I'm using nvm on WSL and nvm-windows on GIt Bash.

            – Anselmo Park
            Jan 6 at 4:15











          • As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

            – Anselmo Park
            Jan 6 at 4:22














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034404%2fwindows-subsystem-for-linux-wsl-using-shared-node-js-installation-with-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I have my own development environment, so I couldn't test it on the same environment of yours.
          But, I suggest that you should check whether npm under "Program Files" works well on WSL.



          user@host:~$ /c/Program Files/nodejs/npm -v


          In my case, another error occurs when running above command.



          Error: EINVAL: invalid argument, uv_pipe_open


          If it is the same on your environment, you may solve this issue first.



          And, about module path issue, it seems to be caused by path; the original npm(under Program Files) and your symbolic link have different current path.



          I modified the original npm as below:



          #!/bin/sh
          (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

          basedir=`dirname "$0"`

          echo $basedir # Added code

          case `uname` in
          *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
          esac
          ...


          If you run the original npm and your symbolic link, $basedir will shows different results, and it causes module path issue.



          If you can solve the first issue(uv_pipe_open error), how about adding the nodejs directory on your path instead of symbolic links?






          share|improve this answer
























          • And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

            – Anselmo Park
            Jan 4 at 9:30











          • I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

            – Sebastian Duque
            Jan 4 at 19:06











          • I'm using nvm on WSL and nvm-windows on GIt Bash.

            – Anselmo Park
            Jan 6 at 4:15











          • As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

            – Anselmo Park
            Jan 6 at 4:22


















          0














          I have my own development environment, so I couldn't test it on the same environment of yours.
          But, I suggest that you should check whether npm under "Program Files" works well on WSL.



          user@host:~$ /c/Program Files/nodejs/npm -v


          In my case, another error occurs when running above command.



          Error: EINVAL: invalid argument, uv_pipe_open


          If it is the same on your environment, you may solve this issue first.



          And, about module path issue, it seems to be caused by path; the original npm(under Program Files) and your symbolic link have different current path.



          I modified the original npm as below:



          #!/bin/sh
          (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

          basedir=`dirname "$0"`

          echo $basedir # Added code

          case `uname` in
          *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
          esac
          ...


          If you run the original npm and your symbolic link, $basedir will shows different results, and it causes module path issue.



          If you can solve the first issue(uv_pipe_open error), how about adding the nodejs directory on your path instead of symbolic links?






          share|improve this answer
























          • And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

            – Anselmo Park
            Jan 4 at 9:30











          • I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

            – Sebastian Duque
            Jan 4 at 19:06











          • I'm using nvm on WSL and nvm-windows on GIt Bash.

            – Anselmo Park
            Jan 6 at 4:15











          • As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

            – Anselmo Park
            Jan 6 at 4:22
















          0












          0








          0







          I have my own development environment, so I couldn't test it on the same environment of yours.
          But, I suggest that you should check whether npm under "Program Files" works well on WSL.



          user@host:~$ /c/Program Files/nodejs/npm -v


          In my case, another error occurs when running above command.



          Error: EINVAL: invalid argument, uv_pipe_open


          If it is the same on your environment, you may solve this issue first.



          And, about module path issue, it seems to be caused by path; the original npm(under Program Files) and your symbolic link have different current path.



          I modified the original npm as below:



          #!/bin/sh
          (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

          basedir=`dirname "$0"`

          echo $basedir # Added code

          case `uname` in
          *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
          esac
          ...


          If you run the original npm and your symbolic link, $basedir will shows different results, and it causes module path issue.



          If you can solve the first issue(uv_pipe_open error), how about adding the nodejs directory on your path instead of symbolic links?






          share|improve this answer













          I have my own development environment, so I couldn't test it on the same environment of yours.
          But, I suggest that you should check whether npm under "Program Files" works well on WSL.



          user@host:~$ /c/Program Files/nodejs/npm -v


          In my case, another error occurs when running above command.



          Error: EINVAL: invalid argument, uv_pipe_open


          If it is the same on your environment, you may solve this issue first.



          And, about module path issue, it seems to be caused by path; the original npm(under Program Files) and your symbolic link have different current path.



          I modified the original npm as below:



          #!/bin/sh
          (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

          basedir=`dirname "$0"`

          echo $basedir # Added code

          case `uname` in
          *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
          esac
          ...


          If you run the original npm and your symbolic link, $basedir will shows different results, and it causes module path issue.



          If you can solve the first issue(uv_pipe_open error), how about adding the nodejs directory on your path instead of symbolic links?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 4 at 9:13









          Anselmo ParkAnselmo Park

          1038




          1038













          • And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

            – Anselmo Park
            Jan 4 at 9:30











          • I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

            – Sebastian Duque
            Jan 4 at 19:06











          • I'm using nvm on WSL and nvm-windows on GIt Bash.

            – Anselmo Park
            Jan 6 at 4:15











          • As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

            – Anselmo Park
            Jan 6 at 4:22





















          • And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

            – Anselmo Park
            Jan 4 at 9:30











          • I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

            – Sebastian Duque
            Jan 4 at 19:06











          • I'm using nvm on WSL and nvm-windows on GIt Bash.

            – Anselmo Park
            Jan 6 at 4:15











          • As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

            – Anselmo Park
            Jan 6 at 4:22



















          And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

          – Anselmo Park
          Jan 4 at 9:30





          And I suggest that you should check simple network node.js program works well. I doubt Windows version node.exe has different implementation for socket.

          – Anselmo Park
          Jan 4 at 9:30













          I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

          – Sebastian Duque
          Jan 4 at 19:06





          I not facing the invalid argument error, what setup are you using? Using the binary from its original location ends in the same behavior but with a different path (the windows one inside WSL) Cannot find module 'C:cProgram Filesnodejsnode_modulesnpmbinnpm-cli.js' There seems to be two things happening here. The npm script is not able to get the canonical path of the symbolic link AND having the correct path, it needs to be transformed to a Windows path: /c/foo/bar/baz > c:/foo/bar/baz. I'm going to try to modify the npm script to achieve this. Maybe this can be PR to node source?

          – Sebastian Duque
          Jan 4 at 19:06













          I'm using nvm on WSL and nvm-windows on GIt Bash.

          – Anselmo Park
          Jan 6 at 4:15





          I'm using nvm on WSL and nvm-windows on GIt Bash.

          – Anselmo Park
          Jan 6 at 4:15













          As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

          – Anselmo Park
          Jan 6 at 4:22







          As I know, Node.js for Windows is not fully compatible with WSL. And some node modules have different implementation on Git Bash and WSL. So, I set up node.js independently on WSL and Git Bash.

          – Anselmo Park
          Jan 6 at 4:22






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034404%2fwindows-subsystem-for-linux-wsl-using-shared-node-js-installation-with-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas