IntelliJ IDEA 14 and angular - full screen debug freezing on concurrent server

I saw this post: The server hangs when running a "concurrent: server" (parallel) task , but the solutions there don't seem to be the source of what I see. I'm wondering if this is a bug with IntelliJ, but I thought I'd ask before I submit to Jetbrains.

I am using a brand new, newly built Yeoman angular-fullstack and am trying to debug in app.js or seed.js, for example, something that runs right after the server starts. So I either need to start the server with node --debug-brk

so that the server waits until I manually connect the debugger or start the server so that IDEA immediately connects its debugger.

The command line works grunt serve

. However, performing the same task in IDEA as a debug configuration is task dependent concurrent:server

.

This is 100% out of the box angular-fullstack, but I'll put the code here for reference anyway.

Here's a portion of the "serve" task that runs when no target is specified, as in the case I'm talking about here:

grunt.task.run([
  'clean:server',
  'env:all',
  'injector:sass',
  'concurrent:server',
  'injector',
  'wiredep',
  'autoprefixer',
  'express:dev',
  'wait',
  'open',
  'watch'
]);

      

Here's the concurrent

part of the Grunt file where things got hung up:

 concurrent: {
      server: [
        'sass',
      ],
      test: [
        'sass',
      ],
      debug: {
        tasks: [
          'nodemon',
          'node-inspector'
        ],
        options: {
          logConcurrentOutput: true
        }
      },
      dist: [
        'sass',
        'imagemin',
        'svgmin'
      ]
    }

      

More details below, but the only way I am currently working is to change the line concurrent:server

in the task to sass

to just use what is in the parallel task server section anyway. it

So now I have the following options that I have tried and the related problems that I am facing:

Approach # 1: Start the server with IDEA's NodeJS debug configurationgrunt serve

  • IDEA uses the --debug-brk option, so the server is waiting for the debugger to attach
  • The debugger from IDEA connects immediately, so the server continues to start quickly
  • The server stops at the "concurrent: server" task. I left it at 6m + unchanged.
  • I did the same through the command line outside of the IDEA debug configuration with the same command line and the same behavior, the only difference is that I manually connect the IDEA debugger to this Node.
  • Seems like parallel stuff messed up IDEA? I tried pulling parallel things out of there (sass task in this case) and that works fine, but aside

Here's the console output for this approach:

/usr/local/bin/node --debug-brk=65524 --nolazy --debug /usr/local/bin/grunt serve
debugger listening on port 65524
Running "serve" task

Running "clean:server" (clean) task

Running "env:all" (env) task

Running "injector:sass" (injector) task
Missing option `template`, using `dest` as template instead
Injecting scss files (3 files)
>> Nothing changed

Running "concurrent:server" (concurrent) task

      

Approach # 2: Using the same debug configuration from # 1, do "run" instead of "debug"

  • IDEA does not use --debug-brk

    on the command line, but the --nolazy

    first line is:/usr/local/bin/node /usr/local/bin/grunt serve

  • Grunt works the same way it does on the command line, but it doesn't attach a debugger and doesn't give me time to do so.

Upstairs, the only way I got this working was to explicitly edit part of the concurrent:server

task. My problem is that if I want a parallel capability, I really don't have the ability to debug early loaded parts of the application without deploying the entire parallel task.

Another option is to create a new IntelliJ-specific task that expands it, but this is still a hack ...

Is this an IntellliJ bug or is something else going on?

+3


source to share


1 answer


The problem is caused by the way Grunt creates child tasks. By default, a child child process uses the same debug port as the parent process - as a result, the forked process is suspended and the application is "stopped". See How to deploy a child process that is listening on a different debug port than the parent , for example.

Try adding



process.execArgv = [];

at the top of your Gruntfile.js

+1


source







All Articles