Skip to content

Debug webstorm #993

Closed
Closed
@david23539

Description

@david23539

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

kamilmysliwiec commented on Aug 22, 2018

@kamilmysliwiec
Member

It's not related to the framework itself. Btw, see here nestjs/typescript-starter#30

kherel

kherel commented on Feb 6, 2019

@kherel

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
screen shot 2019-02-06 at 10 12 43 pm

deyvedvm

deyvedvm commented on Feb 19, 2019

@deyvedvm

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

AmazingTurtle commented on Apr 15, 2019

@AmazingTurtle

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

david23539 commented on Jul 2, 2019

@david23539
Author

thanks

AmazingTurtle

AmazingTurtle commented on Jul 2, 2019

@AmazingTurtle

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",
...
murilozilli

murilozilli commented on Oct 4, 2019

@murilozilli

@AmazingTurtle I get this after that Error: Cannot find module '/home/murilo/project/%NODE_DEBUG_OPTION%'

beaulac

beaulac commented on Dec 20, 2019

@beaulac

@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

coverboy commented on Dec 21, 2019

@coverboy

Selection_036

sprour

sprour commented on Jan 13, 2020

@sprour

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

lock commented on Apr 15, 2020

@lock

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.

locked as resolved and limited conversation to collaborators on Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @coverboy@sprour@AmazingTurtle@beaulac@deyvedvm

        Issue actions

          Debug webstorm · Issue #993 · nestjs/nest