Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Set up Debugging with VS Code

Can't find Node.js binary "node"

Even though Node.js is installed, I can't launch the debugger. I consistently get "Can't find Node.js binary "node": path does not exist. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json".

The Node.js binary is in my path, because a which command in the terminal shows that it's there:

which node /usr/local/bin/node

As a workaround, I can edit the launch.json to point to that, but why doesn't VS Code see it?

2 Answers

Finally found it. I needed to set the global runtimeExecutable setting to the full path instead of just node

Image Link: https://d.pr/i/iPBOwS

After a restart, everything started working. Although I'm still curious why it doesn't recognize the node binary that's in the path.

I had this same error, but my solution was different because my Node.js implementation was the problem. I am running Node on WSL while VS Code is installed on Windows. Because of this, VS Code is unable to natively debug Node.js. The solution to this problem came from the following article:

https://code.visualstudio.com/docs/remote/wsl

After installing VS Code Server, and opening a VS Code WSL window with the 'code .' command, I was able to establish a debugging session. Also, because I created the launch.json file before VS Code Server was installed, the program configuration was written with back-slashes. I had to re-write the configuration with forward slashes as used in Linux, like this:

Before: "version": "0.2.0", "configurations": [ ... "program": "${workspaceFolder}\\bin\\www" ... ]

After: "version": "0.2.0", "configurations": [ ... "program": "${workspaceFolder}/bin/www" ... ]