question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't find Node.js binary "node" using nvm

See original GitHub issue

Describe the bug

I got in the trace:

“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”

when I run such configuration:

{
    "name": "test",
    "request": "launch",
    "type": "node",
    "program": "${workspaceFolder}/index.js",
    "trace": true
}

I use nvm to manage my node install, and the PATH env is set, so I do not want to use runtimeExecutable nor runtimeVersion or anything else that will link to a specific node version. I want to keep using the latest version of node and this managed via nvm only. Just for info, if I set runtimeExecutable or runtimeVersion it launch OK.

If I launch the js script manually in the vscode terminal it launch OK (it finds the node binary).

VS Code Version: Version: 1.62.3 Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247 Date: 2021-11-17T08:00:36.721Z Electron: 13.5.2 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Linux x64 5.4.0-91-generic

JavaScript Debugger (Nightly) v2021.11.1217 (the problem is seen also on standard version of JavaScript Debugger)

nvm: 0.39.0

env
NVM_INC=/home/username/.nvm/versions/node/v16.13.1/include/node
NVM_DIR=/home/username/.nvm
NVM_CD_FLAGS=
NVM_BIN=/home/username/.nvm/versions/node/v16.13.1/bin
PATH=/home/username/.nvm/versions/node/v16.13.1/bin:/home/username/.cargo/bin:/home/username/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

The terminal is bash.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

21reactions
adamchenweicommented, Dec 8, 2021

Ok, my solution is to completely remove the launch.json from the .vscode folder then restart VSCode

12reactions
gaston-23commented, Aug 1, 2022

I’m started to get this error too, on the latest VSCode @ macosx with M1:

code --version
1.68.1
30d9c6cd9483b2cc586687151bcbcd635f373630
arm64

Symptoms are the same:

  • Intergrated terminal has correct path, nvm is working, node binary is there etc.

    • I also have "terminal.integrated.inheritEnv": true, but this seems have no effect on js-debug extension in any way
  • JS debugger can’t attach, because node is not in PATH - We did not find node on your PATH, so we cannot enable auto-attach in your environment.

  • In developer tools of VSCode process.env.PATH looks wrong: process.env.PATH - '/usr/bin:/bin:/usr/sbin:/sbin'

  • Setting up debug.javascript.defaultRuntimeExecutable: {} and pointing it to a node biinary also does not help.

  • Interesting that this error happens even when "debug.javascript.autoAttachFilter": "disabled".

Error message stack trace if this helps :

onDidChangeNotification | @ | workbench.desktop.main.js:802
-- | -- | --
  | (anonymous) | @ | workbench.desktop.main.js:802
  | invoke | @ | workbench.desktop.main.js:67
  | deliver | @ | workbench.desktop.main.js:67
  | fire | @ | workbench.desktop.main.js:67
  | addNotification | @ | workbench.desktop.main.js:802
  | notify | @ | workbench.desktop.main.js:1988
  | (anonymous) | @ | workbench.desktop.main.js:1724
  | _showMessage | @ | workbench.desktop.main.js:1724
  | $showMessage | @ | workbench.desktop.main.js:1724
  | _doInvokeHandler | @ | workbench.desktop.main.js:1731
  | _invokeHandler | @ | workbench.desktop.main.js:1731
  | _receiveRequest | @ | workbench.desktop.main.js:1731
  | _receiveOneMessage | @ | workbench.desktop.main.js:1731
  | (anonymous) | @ | workbench.desktop.main.js:1731
  | invoke | @ | workbench.desktop.main.js:67
  | deliver | @ | workbench.desktop.main.js:67
  | fire | @ | workbench.desktop.main.js:67
  | fire | @ | workbench.desktop.main.js:83
  | _receiveMessage | @ | workbench.desktop.main.js:83
  | (anonymous) | @ | workbench.desktop.main.js:83
  | invoke | @ | workbench.desktop.main.js:67
  | deliver | @ | workbench.desktop.main.js:67
  | fire | @ | workbench.desktop.main.js:67
  | acceptChunk | @ | workbench.desktop.main.js:83
  | (anonymous) | @ | workbench.desktop.main.js:83
  | L | @ | workbench.desktop.main.js:3181
  | emit | @ | node:events:390
  | addChunk | @ | node:internal/streams/readable:315
  | readableAddChunk | @ | node:internal/streams/readable:289
  | Show 2 more frames

in my case, I had the same issue with the process.env.PATH and i fixed adding to settings.json “debug.javascript.defaultRuntimeExecutable”: { “pwa-node”: “/path/to/.nvm/versions/node/vX.X.X/bin/node” },

Hope this helps someone !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find runtime 'node' on PATH - Visual Studio Code and ...
Open your computer terminal (not VSCode terminal) and type node --version to ensure you have node installed. If not, then install node using...
Read more >
can't find node.js binary node path does not exist vscode
I am new to learning Node.js and VS Code. I installed portable VS CODE. It works great with other installed programs. But can't...
Read more >
Debug Node.js Apps using Visual Studio Code
The Visual Studio Code editor includes Node.js debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
Can't find Node.js binary "node" (Example) - Treehouse
Even though Node.js is installed, I can't launch the debugger. I consistently get "Can't find Node.js binary "node": path does not exist.
Read more >
NVM cannot find installed Node binary, PATH problem on ...
From Preference -> Package Settings -> NodeJs -> User Setting Add: { // save before running commands "save_first": true, // if present, use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found