Debugging grunt with Intellij

前端 未结 2 1727
逝去的感伤
逝去的感伤 2020-12-19 12:56

I\'m trying to debug grunt with Intellij (IDEA). The technologies are: NodeJS, express, AngularJS.

The problem: Debugger does not stop on breakpoints.

I\'ll

相关标签:
2条回答
  • 2020-12-19 13:24

    Try installing the JetBrains IDE Support extension for chrome, and then create a javascript Debug configuration like this:
    (source: ignaciosuay.com)

    My grunt server is running in the port 9000, so change it for 3000. note: You need to run grunt before running this configuration. If you have any query, please have a look to this post where is explained step by step how to debug AngularJS with Intellij.

    0 讨论(0)
  • 2020-12-19 13:30

    Just tried a sample Angular+Express application run as a Grunt task. I've used your Gruntfile.js (unchanged). My Node.js Run configuration looks as fololows:

    configuration tab: Node interpreter: C:\Program Files\nodejs\node.exe Javscript file: C:\Users[user]\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt Working directory: my project root - the folder where Gruntfile.js is located

    Live Edit tab: After launch enabled with JavaScript Debugger enabled

    http://localhost:3000
    

    I set breakpoints in my controllers.js and run the configuration above in debugger => breakpoints in Angular code work as expected. Breakpoints in my server code don't :)

    To get breakpoints in server-side code working, I did the following:

    • added 'debug: true' to dev options in Gruntfile.js:

    express: { dev: { options: { script: 'server.js', debug: true } } },

    • modified the node_modules\grunt-express-server\tasks\lib\server.js, line 65, changing '--debug' to '--debug-brk=' ('--debug-brk=47977' in my case)
    0 讨论(0)
提交回复
热议问题