1

I am trying to debug my express js application through visual studio code here is my launch.json

{
    "version": "0.2.0",
    "configurations": [

        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9229
        }
    ],
    "compounds": []
}

And my application is running in port 3000 but when i run debugger i got the following error

Debugging with legacy protocol because Node.js version could not be determined (Error: connect ECONNREFUSED 127.0.0.1:9229)

1 Answer 1

1

You can change request as launch,add protocol as inspector in your file and put your main server file in program, here my server file called as server.js.

 {
   "version": "0.2.0",
   "configurations": [
      {
         "type": "node",
         "request": "launch",
         "name": "Launch Program",
         "protocol": "inspector",
         "program": "${workspaceFolder}/server.js"
      }
   ]
}
Sign up to request clarification or add additional context in comments.

6 Comments

this gave me antoher error Ensure Node was launched with --inspect and is started my app with nodemon --inspect but still the same error
can you update your question with your project structure? what is your name of node main server file?
project created with express-generator and main file is bin/www in the root folder
what is your name of the main server file?
as i told its bin/www www is the main file, i tried with this "program": "${workspaceRoot}/bin/www", but still the same error
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.