Can't find Node.js binary 'node': path does not exist [Fix]

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
3 min

banner

# Can't find Node.js binary 'node': path does not exist [Fix]

Here is the complete error message:

  • "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 first thing you should try to solve the "Can't find Node.js binary "node": path does not exist" error is to:

  1. Completely close Visual Studio Code.
  2. Reopen VS Code.

If you want to open VS Code in a specific directory:

  1. Open your terminal (e.g. bash, zsh or cmd) in the given directory.
  2. Run the code . command.
shell
code .

You can also try to restart VS Code.

If the error persists:

  1. Open VS Code.

  2. Press:

  • Command + Shift + P ( + Shift + P) on macOS
  • Ctrl + Shift + P on Windows
Note: you can also press F1 to open the Command Palette.
  1. Type shell command and select Shell Command: Uninstall 'code' command from PATH.

uninstall code command from path

  1. The next step is to Install 'code' in PATH.

  2. Press:

  • Command + Shift + P ( + Shift + P) on macOS
  • Ctrl + Shift + P on Windows
Note: you can also press F1 to open the Command Palette.
  1. Type shell command and select Shell Command: Install 'code' command in PATH.

install code command in path

  1. Close VS Code and your terminal instances and reopen them.

Note that you must also close your terminal (bash, zsh or cmd) for the PATH environment variable to get updated.

# Setting the runtimeExecutable in your launch.json

If the error persists, try to set the runtimeExecutable in your .vscode/launch.json file.

  1. Run the which node command from your terminal.
shell
which node

run which node command

Make note of the output of the command.

  1. In your .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:

.vscode/launch.json
{ // 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.

set runtime executable in launch json

# Set the default Node.js version with NVM

If the issue persists, try to set the default Node.js version with NVM.

  1. Open your terminal and run the following commands.
shell
nvm install 18.16.0 nvm alias default 18.16.0 nvm use 18.16.0
  1. Close VS Code and reopen it with code ..
shell
code .
  1. Restart your terminal and see if the error is resolved.

# If you aren't debugging your code, delete the launch.json file

If you aren't debugging your code, try to:

  1. Delete the launch.json file from your .vscode/ folder.
  2. Close Visual Studio Code.
  3. Open your terminal in your project's root directory.
  4. Run the code . command.
shell
code .

# Close VS Code and reopen it

If none of the suggestions helped, try to:

  1. Close Visual Studio Code.
  2. Close your terminal for the PATH environment variable to update.
  3. Open your terminal in your project's root directory.
  4. Run the code . command.
shell
code .

# Try to restart your computer

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.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.