Getting error when running nodemon server.js

Issue

I’m using Visual Studio Code to run ExpressJs in debug mode.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}\\nodemon server.js"
        }
    ]
}

I’m getting the following error when I start debugging.

enter image description here

If I run nodemon server.js in the terminal it works. The above error only appears when using Visual Studio Code debugging. I have tried the the following:

  1. Remove node_modules and reinstall node_modules
  2. Reinstall nodemon globally

Solution

I ended up using Visual Studio Code "JavaScript Debug Terminal". In the terminal I run command nodemon server.js and it works.

Answered By – Kestal

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published