DEV Community

Discussion on: FullStack setup (Node.js, React.js and MongoDB)

Collapse
 
leosalgueiro profile image
LeoSalgueiro • Edited

Hi! excellent post. i like this configuration and now i'm using it. But i have a problem, i don't know how configure script for debug in vscode. i was trying but with bad results. Could help me with this?

Collapse
 
pacheco profile image
Thiago Pacheco

Hi Leo,

You can create a file launch.json inside the folder .vscode with the following code:

{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via npm",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "npm",
"runtimeArgs": ["run-script", "dev"],
"port": 9229
},
]
}

Then you can just hit F5 and your app might run.

Let me know if that works for you! :)

Collapse
 
pacheco profile image
Thiago Pacheco

Hi Leo,

Sorry, You should also have a new debug script in your package.json file. Add the following script to your package.json:

"debug": "nodemon --nolazy --inspect-brk=9229 index.js",

Also, update the launch.json runtimeArgs to use this new script:

"runtimeArgs": ["run-script", "debug"],

Let me know if that works for you

Collapse
 
leosalgueiro profile image
LeoSalgueiro • Edited

Hi thiago, Thanks for response. i was make that how you tell me but pick a error ECONNREFUSED.

reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9229.

the .vscode is the same that you give me, and the package.json is the same that the tutorial.
server for mongodb is up, but for the error my targe is wrong.

thi is my index.js

dev-to-uploads.s3.amazonaws.com/i/...