I'm very new to coding and am starting with JS using Visual Studio Code. I'm following some of their tutorial videos and on the very first one when I hit F5 to run the script, I get the following popup error:
Can't find nod.js binary "node": path does not exist. Maek sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json
Then if I click on the Launch.json button it takes me to the code for that, but I'm not sure what to do there. Like I said, very new to coding. I've done some codecademy, but I want to start using an IDE.
EDIT: I uninstalled and reinstalled VS Code and started a new project. I created the folder to save into and title my plain text project as "jsSample.js"
Here's my script:
console.log("---------------");
console.log("Rise & Shine!");
console.log("Ready to learn!");
console.log("---------------");
Then when I hit F5 this window pops up asking me to select a debugger. It lists:
I obviously selected Node.js the first time I tried this, but since reinstalling, I don't know which selection to choose to simply get this to output in the default Debug Console
You can fix this error by doing following 2 steps.
for windows :
code .for me it worked
The easiest way to fix this error is to create and update the launch.json file with the "runtimeExecutable" property.
This solution is for Linux (specifically Ubuntu), let me know how to adapt it to other OS and I will update it.
ctrl + alt + t or open it by some other means and type which node. You will get an output like this:/home/dave/.nvm/versions/node/v18.16.1/bin/node
Next create a launch.json file in a .vscode folder. The quickest way to do this is just to click on the debug icon on the left hand menu, and then selectcreate a launch.json file, which is just under Run and Debug. It will ask you to select a debugger, select Node.js.
Edit that file when it appears, by adding the "runtimeExecutable" field, with its value set to the path to your node binary from step 1. Remember to add a comma after that last field, which should be "program". Your launch.json file should look something like:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With