Closed
Description
I'm submitting a...
[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
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
Nest version: 5.0.0
For Tooling issues:
- Node version: 10.7.0
- Platform: Windows 10 - webstorm 2018.1.5
- NPM version: 6.1.0
Activity
kamilmysliwiec commentedon Aug 22, 2018
It's not related to the framework itself. Btw, see here nestjs/typescript-starter#30
kherel commentedon Feb 6, 2019
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 launchdeyvedvm commentedon Feb 19, 2019
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
AmazingTurtle commentedon Apr 15, 2019
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.
david23539 commentedon Jul 2, 2019
thanks
AmazingTurtle commentedon Jul 2, 2019
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:murilozilli commentedon Oct 4, 2019
@AmazingTurtle I get this after that Error: Cannot find module '/home/murilo/project/%NODE_DEBUG_OPTION%'
beaulac commentedon Dec 20, 2019
@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"
coverboy commentedon Dec 21, 2019
sprour commentedon Jan 13, 2020
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
lock commentedon Apr 15, 2020
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.