Can't find Node.js binary "node" using nvm
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:11 (2 by maintainers)
Top GitHub Comments
Ok, my solution is to completely remove the
launch.json
from the.vscode
folder then restart VSCodein 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 !