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:
- Node.js
- VS Code Extension Development
- Web App (Chrome)
- Web App (Edge)
- Install an extension for JavaScript...
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
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:
- Node.js
- VS Code Extension Development
- Web App (Chrome)
- Web App (Edge)
- Install an extension for JavaScript...
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
Share Improve this question edited Feb 22, 2023 at 20:49 D. Dub asked Feb 22, 2023 at 20:10 D. DubD. Dub 711 gold badge1 silver badge4 bronze badges 3 |4 Answers
Reset to default 7You can fix this error by doing following 2 steps.
for windows :
- open cmd prompt , then type
code .
- Restart VS 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.
- First you need the location of your node binary. To find this, open a terminal with
ctrl
+alt
+t
or open it by some other means and typewhich 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 underRun and Debug
. It will ask you to select a debugger, selectNode.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". Yourlaunch.json
file should look something like:
- Save your file. That should do it, next time you click on the debugger it should run as expected.
this is likely because you installed node with nvm, at least thats why i used to get this error.
start code from the terminal after checking that your PATH contains the folder in which node is installed
assuming a nix like env you can check this with
which node
if starting from terminal without having to add your PATH variable works then the issue likely lies in the fact that the PATH is being added to in ~/.bashrc rather than ~/.bash_profile
set the PATH to include your node installation directory in ~/.bash_profile and then reboot. when you next open vscode and try debugging it should pick up the installation automatically.
or there is the runTimeExecutable option you can set in the launch.json for the js project you're working on.
Adding to the launch.json file by adding the field of "runtimeExecutable" with a value of running "which node" in the terminal worked for me.
Maek
beMake
? (pro-tip. copy and paste) – Wyck Commented Feb 22, 2023 at 20:13