Can't get VSCode debbuging to work with my NodeJs app









up vote
0
down vote

favorite












I'm having trying to debug my app on Visual Studio Code. I have the following config on my package.json:



"scripts": 
"build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files",
"start": "npm run build && node --inspect=12345 dist/app.js"



Im using ES6 on my Node app, that's why it is kinda messy my build config.



When I run npm start everything works fine, I can use my app.



Now to try to debug it, I have set the following launch configurations:



"configurations": [

"type": "node",
"name": "Attach to Remote",
"request": "attach",
"port": 12345
,

"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "$workspaceFolder\dist\app.js"

]


Both of them ""work"": VS Code switch to "debug mode" but I can't hit any breakpoints. They all get grayed out:



enter image description here



I have tried to fix using this answer, but couldn't get it to work...



Any help?



Thanks in advance!










share|improve this question

























    up vote
    0
    down vote

    favorite












    I'm having trying to debug my app on Visual Studio Code. I have the following config on my package.json:



    "scripts": 
    "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files",
    "start": "npm run build && node --inspect=12345 dist/app.js"



    Im using ES6 on my Node app, that's why it is kinda messy my build config.



    When I run npm start everything works fine, I can use my app.



    Now to try to debug it, I have set the following launch configurations:



    "configurations": [

    "type": "node",
    "name": "Attach to Remote",
    "request": "attach",
    "port": 12345
    ,

    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "$workspaceFolder\dist\app.js"

    ]


    Both of them ""work"": VS Code switch to "debug mode" but I can't hit any breakpoints. They all get grayed out:



    enter image description here



    I have tried to fix using this answer, but couldn't get it to work...



    Any help?



    Thanks in advance!










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm having trying to debug my app on Visual Studio Code. I have the following config on my package.json:



      "scripts": 
      "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files",
      "start": "npm run build && node --inspect=12345 dist/app.js"



      Im using ES6 on my Node app, that's why it is kinda messy my build config.



      When I run npm start everything works fine, I can use my app.



      Now to try to debug it, I have set the following launch configurations:



      "configurations": [

      "type": "node",
      "name": "Attach to Remote",
      "request": "attach",
      "port": 12345
      ,

      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "$workspaceFolder\dist\app.js"

      ]


      Both of them ""work"": VS Code switch to "debug mode" but I can't hit any breakpoints. They all get grayed out:



      enter image description here



      I have tried to fix using this answer, but couldn't get it to work...



      Any help?



      Thanks in advance!










      share|improve this question













      I'm having trying to debug my app on Visual Studio Code. I have the following config on my package.json:



      "scripts": 
      "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files",
      "start": "npm run build && node --inspect=12345 dist/app.js"



      Im using ES6 on my Node app, that's why it is kinda messy my build config.



      When I run npm start everything works fine, I can use my app.



      Now to try to debug it, I have set the following launch configurations:



      "configurations": [

      "type": "node",
      "name": "Attach to Remote",
      "request": "attach",
      "port": 12345
      ,

      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "$workspaceFolder\dist\app.js"

      ]


      Both of them ""work"": VS Code switch to "debug mode" but I can't hit any breakpoints. They all get grayed out:



      enter image description here



      I have tried to fix using this answer, but couldn't get it to work...



      Any help?



      Thanks in advance!







      node.js debugging visual-studio-code vscode-debugger






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 14:04









      João Menighin

      1,23241939




      1,23241939






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          I am using VS Code v 1.28.2 and I'm able to debug both ways.



          1) With the built in debuger ( Menu -> Debug -> Start Debuging)



          2) starting the application with node inspect index.js. In that case you have to declare breakpoints in your code with the debugger; keyword. Then, when in debug-mode and stoped in a breakpoint, you continue execution typing cont in the command line.



          hope it helps






          share|improve this answer




















          • Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
            – João Menighin
            Nov 10 at 17:03

















          up vote
          0
          down vote



          accepted










          I found out I was just missing the --source-maps from my babel-cli command... -.-
          After adding it, VSCode is able to find the breakpoints.
          So basically the solution was:



          Add --source-maps to my build command:



          "scripts": 
          "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files --source-maps",
          "start": "npm run build && node --inspect=12345 dist/app.js"



          And I configured a launch as follows:



          "configurations": [

          "type": "node",
          "request": "launch",
          "name": "Launch Program",
          "program": "$workspaceFolder\dist\app.js",
          "preLaunchTask": "npm: build"

          ]


          Hope it helps someone!






          share|improve this answer




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239745%2fcant-get-vscode-debbuging-to-work-with-my-nodejs-app%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I am using VS Code v 1.28.2 and I'm able to debug both ways.



            1) With the built in debuger ( Menu -> Debug -> Start Debuging)



            2) starting the application with node inspect index.js. In that case you have to declare breakpoints in your code with the debugger; keyword. Then, when in debug-mode and stoped in a breakpoint, you continue execution typing cont in the command line.



            hope it helps






            share|improve this answer




















            • Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
              – João Menighin
              Nov 10 at 17:03














            up vote
            0
            down vote













            I am using VS Code v 1.28.2 and I'm able to debug both ways.



            1) With the built in debuger ( Menu -> Debug -> Start Debuging)



            2) starting the application with node inspect index.js. In that case you have to declare breakpoints in your code with the debugger; keyword. Then, when in debug-mode and stoped in a breakpoint, you continue execution typing cont in the command line.



            hope it helps






            share|improve this answer




















            • Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
              – João Menighin
              Nov 10 at 17:03












            up vote
            0
            down vote










            up vote
            0
            down vote









            I am using VS Code v 1.28.2 and I'm able to debug both ways.



            1) With the built in debuger ( Menu -> Debug -> Start Debuging)



            2) starting the application with node inspect index.js. In that case you have to declare breakpoints in your code with the debugger; keyword. Then, when in debug-mode and stoped in a breakpoint, you continue execution typing cont in the command line.



            hope it helps






            share|improve this answer












            I am using VS Code v 1.28.2 and I'm able to debug both ways.



            1) With the built in debuger ( Menu -> Debug -> Start Debuging)



            2) starting the application with node inspect index.js. In that case you have to declare breakpoints in your code with the debugger; keyword. Then, when in debug-mode and stoped in a breakpoint, you continue execution typing cont in the command line.



            hope it helps







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 10 at 14:57









            gkont

            1039




            1039











            • Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
              – João Menighin
              Nov 10 at 17:03
















            • Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
              – João Menighin
              Nov 10 at 17:03















            Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
            – João Menighin
            Nov 10 at 17:03




            Thanks for the answer, gkont. This did work but I was expecting to use breakpoints instead of debugger. I found out a solution! Thanks!
            – João Menighin
            Nov 10 at 17:03












            up vote
            0
            down vote



            accepted










            I found out I was just missing the --source-maps from my babel-cli command... -.-
            After adding it, VSCode is able to find the breakpoints.
            So basically the solution was:



            Add --source-maps to my build command:



            "scripts": 
            "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files --source-maps",
            "start": "npm run build && node --inspect=12345 dist/app.js"



            And I configured a launch as follows:



            "configurations": [

            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "$workspaceFolder\dist\app.js",
            "preLaunchTask": "npm: build"

            ]


            Hope it helps someone!






            share|improve this answer
























              up vote
              0
              down vote



              accepted










              I found out I was just missing the --source-maps from my babel-cli command... -.-
              After adding it, VSCode is able to find the breakpoints.
              So basically the solution was:



              Add --source-maps to my build command:



              "scripts": 
              "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files --source-maps",
              "start": "npm run build && node --inspect=12345 dist/app.js"



              And I configured a launch as follows:



              "configurations": [

              "type": "node",
              "request": "launch",
              "name": "Launch Program",
              "program": "$workspaceFolder\dist\app.js",
              "preLaunchTask": "npm: build"

              ]


              Hope it helps someone!






              share|improve this answer






















                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                I found out I was just missing the --source-maps from my babel-cli command... -.-
                After adding it, VSCode is able to find the breakpoints.
                So basically the solution was:



                Add --source-maps to my build command:



                "scripts": 
                "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files --source-maps",
                "start": "npm run build && node --inspect=12345 dist/app.js"



                And I configured a launch as follows:



                "configurations": [

                "type": "node",
                "request": "launch",
                "name": "Launch Program",
                "program": "$workspaceFolder\dist\app.js",
                "preLaunchTask": "npm: build"

                ]


                Hope it helps someone!






                share|improve this answer












                I found out I was just missing the --source-maps from my babel-cli command... -.-
                After adding it, VSCode is able to find the breakpoints.
                So basically the solution was:



                Add --source-maps to my build command:



                "scripts": 
                "build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files --source-maps",
                "start": "npm run build && node --inspect=12345 dist/app.js"



                And I configured a launch as follows:



                "configurations": [

                "type": "node",
                "request": "launch",
                "name": "Launch Program",
                "program": "$workspaceFolder\dist\app.js",
                "preLaunchTask": "npm: build"

                ]


                Hope it helps someone!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 10 at 17:05









                João Menighin

                1,23241939




                1,23241939



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239745%2fcant-get-vscode-debbuging-to-work-with-my-nodejs-app%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20