Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

VS Code debugger cannot find node when you press F5

ErrorCannot find runtime 'node' on PATH.

Short answer

The Node.js debugger starts the program named in runtimeExecutable, which defaults to node, and finds it through PATH. The error means that lookup failed in VS Code's environment. Check that node runs in a terminal, then set runtimeExecutable to an absolute path, or use runtimeVersion if you switch versions with nvm.

  • Applies to VS Code (current stable), Node.js 22, nvm
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the terminal inside VS Code and ask where node is. If nothing prints, the shell has no node either, and the fix is the installation. If it prints a path, copy the path for the launch.json fix.

    command -v node
    node --version
  2. 2Match what you see, then jump to its fix

    1. 1command -v node prints nothing, or prints a path only in some terminalsnode is not installed, or not on the PATH VS Code starts withFix
    2. 2node works in your shell after nvm loads, but the debugger cannot find itVersions are managed with nvm and the debugger has no version selectedFix

What does the error look like?

  • Cannot find runtime 'node' on PATH.

Cause 1 of 2

node is not installed, or not on the PATH VS Code starts with

1Check

The debugger runs the program in runtimeExecutable; the default is node. It is looked up on PATH like any other program.

command -v node

2Fix

Install Node.js (or install nvm and a Node.js version), then set the absolute path of the executable in launch.json.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceFolder}/index.js",
      "runtimeExecutable": "/absolute/path/from/command-v-node"
    }
  ]
}

3Verify

Press F5 with this configuration; the program starts and the debug toolbar appears.

node --version

Confirmed by code.visualstudio.com

Did this fix it?

Cause 2 of 2

Versions are managed with nvm and the debugger has no version selected

1Check

nvm adds its Node.js versions to PATH only in shells where its profile snippet has run. VS Code can instead select an installed version itself with the runtimeVersion attribute.

nvm ls

2Fix

Set runtimeVersion in the launch configuration to a version that nvm has installed. The feature does not download versions; with only a major number it uses the newest installed version of that line.

{
  "type": "node",
  "request": "launch",
  "name": "Launch Program",
  "program": "${workspaceFolder}/index.js",
  "runtimeVersion": "22"
}

3Verify

Start the debug session and check the version in the debug console.

console.log(process.version)

Confirmed by code.visualstudio.com

Did this fix it?

How do I stop it coming back?

  • Commit a launch.json that uses runtimeVersion, so the team debugs on the same Node.js line.
  • Install the version with nvm before you set runtimeVersion; VS Code does not install it.
  • Keep the absolute runtimeExecutable path out of shared files, since it differs per machine.
  • Set an nvm default alias so new shells have node.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.