Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Cannot find runtime 'nodemon' on PATH. Make sure to have 'nodemon' installed."?

I try to debug nodejs app with nodemon on visual studio code so that I can auto restart the debugger each time I save my code. However, it just kept poping up this error message when I run my debugger on visual studio code: "Cannot find runtime 'nodemon' on PATH. Make sure to have 'nodemon' installed"

I have tried to reinstall visual studio code, reinstall nodemon globally and locally.

Here is my launch.json file:

  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "nodemon",
      "runtimeExecutable": "nodemon",
      "program": "${workspaceFolder}/app.js",
      "restart": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    }
  ]```
like image 308
LittleTeemo Avatar asked Sep 01 '19 19:09

LittleTeemo


2 Answers

I solved this issue by installing nodemon as global.

npm install -g nodemon
like image 105
Muhammad Afif Avatar answered Sep 23 '22 19:09

Muhammad Afif


The solution I've found here.

First, run the follow command:

which node .

So then, you will get the node path, something like: "/home/user/.nvm/versions/node/v12.16.1/bin/node"

Then, you update your launch.json with:

{
    ...
    "runtimeExecutable": "/home/user/.nvm/versions/node/v12.16.1/bin/node"
    ...
}
like image 21
Vítor Resende Avatar answered Sep 22 '22 19:09

Vítor Resende