简体   繁体   中英

Unable to debug the Nodejs application in Visual studio code

I have launch configuration for my Nodejs with ExpressJs application, the debugger mode starts and then immediately stops.. It doesn't keep on listening.. any help is much appreciated.

{
    "name": "Launch via NPM",
    "type": "node",
    "request": "launch",
    "cwd": "${workspaceFolder}/index.js",
    "runtimeExecutable": "npm",
    "runtimeArgs": [
        "run-script", "debug"
    ],
    "port": 9229
}

Below is my server configuration

app.listen(PORT, HOST, () => {
  process.stdout.write(Server is listening on ${PORT} (${NODE_ENV})\n)
  log.info(Server is listening on ${PORT} (${NODE_ENV})\n)
})

Start commands in package.json

"devStart": "nodemon --exec babel-node index.js",

"start": "per-env",

"start:development": "nodemon --exec babel-node index.js",

The issue is resolved by below steps..

1.) Followed the steps as suggested by Mickers in the above comments

2.) (for the async module issue ) rm -rf node_modules

followed by -- npm install

The debugger is successfully attached

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM