VS Code debugger cannot find node when you press F5
Cannot 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.
Fix it fast
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 --version2Match what you see, then jump to its fix
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 node2Fix
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 --versionConfirmed by code.visualstudio.com
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 ls2Fix
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
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 fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack 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 fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fix