Closed david23539 closed 6 years ago
It's not related to the framework itself. Btw, see here https://github.com/nestjs/typescript-starter/issues/30
I'm using mac, but It's probably be very similar.
If you are using nest.js cli with nodemon-debug.json
"exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register src/main.ts"
you only need to specify the port, witch by default is 9229
plus run npm/yarn script start:debug
before debugger launch
I was able to run debug int WebStorm after changing the path of the main.ts file:
Before:
"exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register src/main.ts"
After:
"exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register ./src/main.ts"
I followed the Jetbrains tutorial: https://www.jetbrains.com/help/webstorm/running-and-debugging-node-js.html
What about NODE_DEBUG_OPTION? Webstorm is telling me to use that instead when debugging a npm script. Would love to see that working with nodemon.
thanks
I found a solution to debug nestjs in webstorm. Create a new script in your package.json. In webstorm you can just right-click -> debug in the npm scripts
window. I use the following script for that:
...
"start:debug:webstorm": "node %NODE_DEBUG_OPTION% -r ts-node/register -r tsconfig-paths/register src/main.ts",
...
@AmazingTurtle I get this after that Error: Cannot find module '/home/murilo/project/%NODE_DEBUG_OPTION%'
@murilozilli That example is for windows, on Linux/Mac it should be:
"node $NODE_DEBUG_OPTION -r ts-node/register -r tsconfig-paths/register src/main.ts"
You can install dev dependency @nestjs/cli, then put the following settings: Node parameters: Full path/node_modules/@nestjs/cli/bin/nets.js start --watch Working directory: Project root Js file: src/main.ts
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
Webstorm can't debug with nest's command
npm run start
Minimal reproduction of the problem with instructions
Webstorm's breakpoints don't work in debug mode
Environment