Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node binary not found in PATH by IDE, yet shows during `echo $PATH` (Ubuntu Linux)

VSCode shows the following alert in a prompt:

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

In terminal I see an NVM path to node:

$ node --version
v12.18.4

$ echo $PATH
/home/owner/.config/nvm/versions/node/v12.18.4/bin
:/usr/local/sbin:/usr/local/bin:/usr/sbin
:/usr/bin:/sbin:/bin:/usr/games
:/usr/local/games:/snap/bin
// line breaks manually added by me for readability

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

$ npm --version
6.14.6

Does anyone know how to fix this PATH issue?

I suspect the issue is with PATH and not VsCode but am including my launch.json below in case I'm wrong.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "pwa-node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": [
        "<node_internals>/**",
        "node_modules"
      ],
      "program": "${workspaceFolder}/src/server.ts",
      "preLaunchTask": "tsc: build - tsconfig.json",
      "outFiles": [
        "${workspaceFolder}/compiled/**/*.js"
      ],
      "runtimeExecutable": "node"
    }
  ]
}
Other Attempts to fix this

Restarting Computer - The PATH issue still presented

Adding / removing runtimeExecutable k/v pair from above config file - Also no change

like image 964
Sean D Avatar asked Oct 26 '22 17:10

Sean D


1 Answers

update launch.json with this

  "runtimeExecutable": "/usr/local/bin/node",
like image 172
Enrique Rubio Sanchez Avatar answered Oct 29 '22 07:10

Enrique Rubio Sanchez