Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging in VSCode not working #1543

Closed
atul221282 opened this issue Feb 9, 2019 · 9 comments
Closed

Debugging in VSCode not working #1543

atul221282 opened this issue Feb 9, 2019 · 9 comments

Comments

@atul221282
Copy link

atul221282 commented Feb 9, 2019

I'm submitting a issue with VSCode debugging in windows 10

Current behavior

Running npm run start:debug is not debugging application in VSCode with Auto Attach: On. npm run start:debug command not even running the application. Please see attached image
image

Expected behavior

Running npm run start:debug debugs the application in VSCode with Auto Attach: On

Minimal reproduction of the problem with instructions

Your repo https://github.com/nestjs/typescript-starter not working in windows 10

What is the motivation / use case for changing the behavior?

Debugging is really important for any application.

Environment


Nest version: 5.8.0

 
For Tooling issues:
- Node version: v9.11.1
- Platform:  Windows

Others:
VSCode version :1.31.0
@immanuel192
Copy link

Here is my configuration in launch.json, hope it can help

{
      "name": "Launch app",
      "type": "node",
      "request": "launch",
      "args": [
        "src/main.ts"
      ],
      "runtimeArgs": [
        "-r",
        "ts-node/register",
        "-r",
        "tsconfig-paths/register"
      ],
      "cwd": "${workspaceRoot}",
      "protocol": "inspector",
      "internalConsoleOptions": "openOnSessionStart",
      "env": {
        "NODE_ENV": "local",
        "NODE_PORT": "9000"
      },
      "sourceMaps": true,
      "console": "internalConsole",
      "outputCapture": "std"
    }

@immanuel192
Copy link

@atul221282 You can ignore tsconfig-paths if you dont use path mapping in your project. In my project, I can setup debug for main app, unit test, e2e test. From my understanding, it is better that you dont use nodemon when setup debugging.

@atul221282
Copy link
Author

@immanuel192 Thanks for providing the another solution, I will definitely try. However this issue is still need a fix :)

@atul221282
Copy link
Author

@atul221282 You can ignore tsconfig-paths if you dont use path mapping in your project. In my project, I can setup debug for main app, unit test, e2e test. From my understanding, it is better that you dont use nodemon when setup debugging.

I copied your config file and then started debugging from visual studio but it not launching the app. Can you please explain in few dot points the step that I need to take after adding the launch.json file

@skreborn
Copy link

@atul221282 There was an issue opened for this in the VSCode repository. This issue has since been closed in favor of another one, marking the former as a duplicate. Hopefully, this is the same issue you're experiencing.

@atul221282
Copy link
Author

@skreborn No this is not same as that one, I am saying running npm run start:debug with Auto Attach On should run the application in debug mode but it not happening. There are other issues as well but I want to keep this simple and see what is the actual problem

@atul221282
Copy link
Author

@atul221282 You can ignore tsconfig-paths if you dont use path mapping in your project. In my project, I can setup debug for main app, unit test, e2e test. From my understanding, it is better that you dont use nodemon when setup debugging.

I tried your script and got debugging to work but whenever I make any change to file and refresh browser I don't see my change in browser. I have to restart the app and run the debug again. Is it expected behavior coz I think that is not right?

@kamilmysliwiec
Copy link
Member

Actually, debugging has nothing to do with the framework itself - it's not an issue. I'll add a tutorial on how to debug apps to the docs soon (let's track this here - nestjs/docs.nestjs.com#217)

@lock
Copy link

lock bot commented Sep 24, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants