ChrisWren / grunt-nodemon

Grunt task to run nodemon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grunt task launch reports debugger listening but no process is listening on the reported port

rainabba opened this issue · comments

I have all other tools and modules working but no matter how I try, the only way I can get a debugger listening is to modify my grunt.cmd to include --debug which results in me getting a debugger on grunt instead of my app. I suspect this issue is from a combination of your approach and Windows because I'm having the same problem with grunt-node-inspector. Below is my Gruntfile config for nodemon and my launch output.

I'd be happy to work with you in my environment using TeamViewer if you want to troubleshoot in place. I'm confirming that there is no process listening on 5858 using Windows native Resource Monitor and node is only listening on the following ports (9000 is my app): 9000, 35729 and 61750. I've tried attaching to the last 2 just in case, but neither give me a session.

Also, documentation doesn't make it clear (and it's not obvious to someone new to grunt like myself) but I found the hard way that the object in nodemon must match the grunt task name so for a long time, I wasn't even able to successfully use my options because my task wasn't called dev. Perhaps in the docs, rename "dev" to something like "yourGruntTaskName"?

nodemon: {
  dev: {
    options: {
      file: 'app.js',
      nodeArgs: ['--debug'],
      env: {
        PORT: '5858'
      }
    }
  }
}

LAUNCH OUTPUT:

C:\batchManWebService_Hapi>grunt dev
to: wrong arguments

Running "dev" task

Running "clean:server" (clean) task
Cleaning ".tmp"...OK

Running "compass:server" (compass) task
directory .tmp/styles/
   create .tmp/styles/main.css (1.379s)
Compilation took 1.381s

Running "connect:livereload" (connect) task
Started connect web server on localhost:9000.

Running "copy:dist" (copy) task
Created 1 directories, copied 3 files

Running "open:server" (open) task

Running "concurrent:devNodemon" (concurrent) task
to: wrong arguments

to: wrong arguments

to: wrong arguments

Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...Running "devtools" task
16 Dec 12:09:29 - [nodemon] v0.7.10
16 Dec 12:09:29 - [nodemon] to restart at any time, enter `rs`
16 Dec 12:09:29 - [nodemon] watching: C:\batchManWebService_Hapi
16 Dec 12:09:29 - [nodemon] starting `node --debug app.js`
debugger listening on port 5858
Your app is now running
16 Dec 12:09:29 - [nodemon] clean exit - waiting for changes before restart
>> Grunt Devtools v0.2.1 is ready! Proceed to the Chrome extension.

What does app.js do? I see the following line which means that the app finished executing and isn't running:

16 Dec 12:09:29 - [nodemon] clean exit - waiting for changes before restart

If you are trying to debug a script which exits after executing, try using the --debug-brk flag which will set a breakpoint on the first line and let you debug from there. --debug will not set the breakpoint before the process finishes executing and as such you won't be able to debug. --debug should be used on a web server whereas debug-brk should be used on a cli tool which executes a task.

Also, why are you passing 5858 as the port to your app? I believe that will conflict with the debug port.

Closing for inactivity, feel free to comment with more info