I am using the Windows Subsystem for Linux and I have node installed on Linux. I'm using Visual Studio Code and I want to debug a node.js application. When I use the debugger I get the warning that it cannot find runtime 'node' on PATH. When I install node in Windows and add it to PATH, visual studio code debugger works fine. But to use the Windows installed node in WSL, I have to use an alias, and then npm doesn't work correctly from Linux command line. I'd much rather just use the node installed in Linux and add that to path if it was possible so that visual studio code debugger would work and I wouldn't have to install node in both windows and WSL. Is this even possible?
Asked
Active
Viewed 393 times
1 Answers
0
I was having a similar issue, and the key was to create the project folder and files in WSL mode and launch the VSCode program in WSL mode, rather than opening VSCode from the Windows start menu, as mentioned in this SO post.
In other words, you can open your WSL terminal, create your project directory in the WSL file system, navigate into your project folder, and type code .
and it will launch VSCode and it should pick up the node path correctly, although you may also have to specify it for your VSCode project in launch.json
.

CBeng
- 23
- 5