Last updated: Apr 5, 2024
Reading time·3 min
Here is the complete error message:
The first thing you should try to solve the "Can't find Node.js binary "node": path does not exist" error is to:
If you want to open VS Code in a specific directory:
bash
, zsh
or cmd
) in the given directory.code .
command.code .
You can also try to restart VS Code.
If the error persists:
Open VS Code.
Press:
Command
+ Shift
+ P
(⌘
+ Shift
+ P
) on macOSCtrl
+ Shift
+ P
on WindowsF1
to open the Command Palette.The next step is to Install 'code' in PATH.
Press:
Command
+ Shift
+ P
(⌘
+ Shift
+ P
) on macOSCtrl
+ Shift
+ P
on WindowsF1
to open the Command Palette.Note that you must also close your terminal (bash
, zsh
or cmd
) for the
PATH environment variable to get updated.
runtimeExecutable
in your launch.json
If the error persists, try to set the runtimeExecutable
in your
.vscode/launch.json
file.
which node
command from your terminal.which node
Make note of the output of the command.
.vscode/launch.json
file, set the runtimeExecutable
property to
the path you got from running the which node
command.For me, it looks as follows:
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", "skipFiles": ["<node_internals>/**"], "program": "${workspaceFolder}/index.js", "runtimeExecutable": "/home/borislav/.nvm/versions/node/v20.1.0/bin/node" } ] }
Make sure to update the value of the runtimeExecutable
property with the path
you got from the which node
command.
If you don't have a launch.json
file in your .vscode
directory, you can
create it.
If the issue persists, try to set the default Node.js version with NVM.
nvm install 18.16.0 nvm alias default 18.16.0 nvm use 18.16.0
code .
.code .
launch.json
fileIf you aren't debugging your code, try to:
launch.json
file from your .vscode/
folder.code .
command.code .
If none of the suggestions helped, try to:
code .
command.code .
If the issue persists, try to restart your computer.
This often helps because it will update the value of the PATH environment variable.
An outdated PATH environment variable that doesn't get picked up by VS Code is the main cause of the error.
If you are getting the error 'node' is not recognized as an internal or external command on Windows, click on the link and follow the instructions.
You can learn more about the related topics by checking out the following tutorials: