Home > database >  Getting error when running nodemon server.js
Getting error when running nodemon server.js

Time:08-24

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

CodePudding user response:

You need to update this code line

"program": "${workspaceFolder}\\nodemon server.js"

to

"program": "nodemon ${workspaceFolder}\server.js"

CodePudding user response:

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

  • Related