Reputation: 1058
Node js Version :v8.11.3
VS Code version :1.29.1 x64
npm version :6.6.0
Hi ,
I have created a default express skeleton project using express --view=jade myapp
command after that cd myapp/
and npm install
in the last.
Now I am trying to attach vscode debugger to this newly created project but no luck.
This is the content of my launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"protocol":"inspector",
"port":3000,
"program": "/home/pankaj/myfirstapp/myapp/app.js"
}
]
}
I am also not able to see any error in the debug console .There is nothing in debug console neither success nor failure.
Thanks In advance
Upvotes: 2
Views: 2694
Reputation: 1058
Be careful for express default setup to set the path of program
in launch.json to "program": "${workspaceFolder}/bin/www"
Upvotes: 1
Reputation: 1977
Port 3000 is the application port of your express application. If you specify this in your launch configuration, the VS Code debugger will try to use it as the debug port (which obviously cannot work).
In addition, use VS Code variables to specify where your programs lives. E.g. if you have opened VS Code on your myapp
directory, use ${workspaceFolder}/app.js
for the program
attribute:
E.g.:
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app.js"
}
Upvotes: 0