0

I am trying to use the Vscode debugger to debug my Nodejs program. But as soon as I click on "Launch Program" the debugger starts for a second and then closes automatically. Its giving no information at all. It is working on other applications on my system. Here is my launch.json file -

{
    // 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": "pwa-node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}/newReconBackend/src/modules/dayWiseOperatorDue/dayWiseOperatorDue.service.js"
        }
    ]
}

Is there some problem with the program field? What should be the path? I tried setting the program field to my index.js file (from where the application start) but its givving the below error then -

launch.json

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "type": "pwa-node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}/newReconBackend/src/index.js"
        }
    ]
}

Error

Process exited with code 1
Uncaught Error Error: Config validation error: "NODE_ENV" is required
    at <anonymous> (/Users/naimafarooqi/Documents/Recon app/newReconBackend/src/config/config.js:60:9)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at <anonymous> (/Users/naimafarooqi/Documents/Recon app/newReconBackend/src/config/logger.js:5:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at <anonymous> (/Users/naimafarooqi/Documents/Recon app/newReconBackend/src/index.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Module._load (internal/modules/cjs/loader.js:769:14)
    at executeUserEntryPoint (internal/modules/run_main.js:72:12)
    at <anonymous> (internal/main/run_main_module.js:17:47)
Roomi
  • 139
  • 8

0 Answers0