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

3

8

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"
    }
  ]```
Cereal answered 1/9, 2019 at 19:3 Comment(0)
D
14

I solved this issue by installing nodemon as global.

npm install -g nodemon
Daphinedaphna answered 3/12, 2019 at 7:29 Comment(1)
Thanks. This fix my issue in my windows system running Node 12+ with VS 1.49. Updating runtimeExecutable in launch.json does not work for me. "runtimeExecutable":"d:/nodejson"Wellwisher
C
4

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"
    ...
}
Coax answered 2/4, 2020 at 21:25 Comment(1)
This solved it for me after I installed NVM. Thanks!Stevenson
N
0

I often get this error when I restart my computer. The reason is that vscode can't load nodemon's path. The way I fixed it was to close the vscode window that was crashing and reopen it through the terminal with the command "code ./your_folder". Good luck.

Netsuke answered 3/1, 2023 at 3:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.