Reputation: 1975
I try to debug my nestjs application, I follow this article, https://javascript.plainenglish.io/debugging-nestjs-in-vscode-d474a088c63b but still cannot debug the application
This is my launch.json
{
"type": "node",
"request": "launch",
"name": "Debug Nest Framework",
"args": [
"${workspaceFolder}/api/src/main.ts"
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register",
"-r",
"tsconfig-paths/register"
],
"sourceMaps": true,
"envFile": "${workspaceFolder}/.env",
"cwd": "${workspaceRoot}/api",
"console": "integratedTerminal",
"protocol": "inspector"
}
when I debugging the app seems start debugging but after get this error
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/companies/companies.service.ts:13:49 - error TS2304: Cannot find name 'Company'.
How can I debug this app?
Upvotes: 1
Views: 5936
Reputation: 216
No need to config luanch.json..
it will hit the line you want to debug
Upvotes: 2
Reputation: 70131
Instead of setting up an entire debug script, you can make use of the one Nest sets up in new applications for you. start:debug
maps to nest start --debug
which starts your server (after building it if needed) and adds the --insert-brk
flag for node to know you need the debug port available. Then you can use VSCode
to attach
to port 9229
and start debugging.
Upvotes: 1