NodeJS, launched from inside Webstorm, doesn't execute grunt?

Hi,

I'm working with webhost 9 and using it to debug NodeJS.  my NodeJS has the sails framework which uses grunt to do some pre-processing each time the server starts (for example, it moves all my static files into a central public folder).  When I launch node from the command line, it works perfectly fine, but when I launch it through the IDE it does everything EXCEPT run grunt.  It seems to skip it and just start the server.  Please see the logs below (generated with node's --verbose option).

Has anyone else seen this?


WebHost log (no grunt execution)

"C:\Program Files (x86)\JetBrains\WebStorm 139.12\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=61838 --nolazy app.js --verbose
debugger listening on port 61838
verbose: Setting Node environment...
verbose: Please run `npm install coffee-script` to use coffescript (skipping for now)
verbose: moduleloader hook loaded successfully.
verbose: Loading app config...
verbose: userconfig hook loaded successfully.
verbose: Exposing global variables... (you can disable this by modifying the properties in `sails.config.globals`)
verbose: logger hook loaded successfully.
verbose: request hook loaded successfully.
verbose: Loading the app's models and adapters...
verbose: Loading app models...
verbose: Loading app adapters...
verbose: Loading blueprint middleware...
Tue, 14 Oct 2014 13:00:54 GMT i18n:debug will write to c:\Users\myuser\git\datavis\config\locales\en.json
verbose: blueprints hook loaded successfully.
Tue, 14 Oct 2014 13:00:54 GMT i18n:debug read c:\Users\myuser\git\datavis\config\locales\en.json for locale: en
verbose: Loading runtime custom response definitions...
Tue, 14 Oct 2014 13:00:54 GMT i18n:debug will write to c:\Users\myuser\git\datavis\config\locales\es.json
verbose: Tue, 14 Oct 2014 13:00:54 GMT i18n:debug read c:\Users\myuser\git\datavis\config\locales\es.json for locale: es
responses hook loaded successfully.
Tue, 14 Oct 2014 13:00:54 GMT i18n:debug will write to c:\Users\myuser\git\datavis\config\locales\fr.json
verbose: Tue, 14 Oct 2014 13:00:54 GMT i18n:debug read c:\Users\myuser\git\datavis\config\locales\fr.json for locale: fr
controllers hook loaded successfully.
verbose: Loading policy modules from app...
Tue, 14 Oct 2014 13:00:54 GMT i18n:debug will write to c:\Users\myuser\git\datavis\config\locales\de.json
verbose: Tue, 14 Oct 2014 13:00:54 GMT i18n:debug read c:\Users\myuser\git\datavis\config\locales\de.json for locale: de
Finished loading policy middleware logic.
verbose: policies hook loaded successfully.
verbose: Loading app services...
verbose: services hook loaded successfully.
verbose: csrf hook loaded successfully.
verbose: cors hook loaded successfully.
verbose: i18n hook loaded successfully.
verbose: session hook loaded successfully.
verbose: Loading app Gruntfile...
verbose: Tracking new grunt child process...
debug: --------------------------------------------------------
debug: verbose: grunt hook loaded successfully.
verbose: :: Tue Oct 14 2014 09:00:56 GMT-0400 (Eastern Daylight Time)http hook loaded successfully.

verbose: Overriding ejs engine config with ejslocals to implement layout support...
debug: verbose: Environment : development
Configuring socket (ws://) server...
debug: verbose: Host        : 0.0.0.0
sockets hook loaded successfully.
debug: verbose: Port        : 8181
Loading user hooks...
debug: verbose: Located 0 user hook(s)...
--------------------------------------------------------verbose:
views hook loaded successfully.
verbose: Setting default Express view engine to ejs...
verbose: Initialized 0 user hook(s)...
verbose: userhooks hook loaded successfully.
verbose: Loading adapter ( sails-disk ) for sdm  from `node_modules` directory...
verbose: Starting ORM...
verbose: orm hook loaded successfully.
verbose: pubsub hook loaded successfully.
verbose: Built-in hooks are ready.
verbose: Instantiating registry...
verbose: Loading router...
verbose: Policy-controller bindings complete!
verbose: Waiting for all hooks to declare that they're ready...
verbose: All hooks were loaded successfully.
verbose: Starting app at c:\Users\myuser\git\datavis...
verbose: Running the setup logic in `sails.config.bootstrap(cb)`...
verbose: Restricting access to explicit host: 0.0.0.0
info:
info:
info:    Sails              <|
info:    v0.10.5             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------'
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info:
info: Server lifted in `c:\Users\myuser\git\datavis`
info: To see your app, visit http://0.0.0.0:8181
info: To shut down Sails, press <CTRL> + C at any time.


verbose: Rendering view: "home/index" (located @ "c:\Users\myuser\git\datavis\views\home\index")
verbose: • using configured layout:: layout (located @ "c:\Users\myuser\git\datavis\views\layout")
verbose: Rendering view: "home/index" (located @ "c:\Users\myuser\git\datavis\views\home\index")
verbose: • using configured layout:: layout (located @ "c:\Users\myuser\git\datavis\views\layout")
verbose: browser client (v0.10.0) is trying to connect a socket...
verbose: Connected socket to existing session....
verbose: authorized
verbose: handshake authorized BscLGJu0OIkHSfBTv0M5
verbose: setting request GET /socket.io/1/websocket/BscLGJu0OIkHSfBTv0M5?__sails_io_sdk_version=0.10.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript
verbose: set heartbeat interval for client BscLGJu0OIkHSfBTv0M5
verbose: client authorized for
verbose: websocket writing 1::
verbose: A socket.io client (BscLGJu0OIkHSfBTv0M5) connected successfully!
verbose: Sending 404 ("Not Found") response


And the direct execution from the command line, where it does work (notice the grunt stuff after the sails ascii art..

C:\Users\myuser\git\datavis>node app.js --verbose
verbose: Setting Node environment...
verbose: Please run `npm install coffee-script` to use coffescript (skipping for now)
verbose: moduleloader hook loaded successfully.
verbose: Loading app config...
verbose: userconfig hook loaded successfully.
verbose: Exposing global variables... (you can disable this by modifying the properties in `sails.config.globa
verbose: logger hook loaded successfully.
verbose: request hook loaded successfully.
verbose: Loading the app's models and adapters...
verbose: Loading app models...
verbose: Loading app adapters...
verbose: Loading blueprint middleware...
verbose: blueprints hook loaded successfully.
verbose: Loading runtime custom response definitions...
verbose: responses hook loaded successfully.
verbose: controllers hook loaded successfully.
verbose: Loading policy modules from app...
verbose: Finished loading policy middleware logic.
verbose: policies hook loaded successfully.
verbose: Loading app services...
verbose: services hook loaded successfully.
verbose: csrf hook loaded successfully.
verbose: cors hook loaded successfully.
  i18n:debug will write to C:\Users\myuser\git\datavis\config\locales\en.json +0ms
  i18n:debug read C:\Users\myuser\git\datavis\config\locales\en.json for locale: en +1ms
  i18n:debug will write to C:\Users\myuser\git\datavis\config\locales\es.json +1ms
  i18n:debug read C:\Users\myuser\git\datavis\config\locales\es.json for locale: es +0ms
  i18n:debug will write to C:\Users\myuser\git\datavis\config\locales\fr.json +0ms
  i18n:debug read C:\Users\myuser\git\datavis\config\locales\fr.json for locale: fr +1ms
  i18n:debug will write to C:\Users\myuser\git\datavis\config\locales\de.json +0ms
  i18n:debug read C:\Users\myuser\git\datavis\config\locales\de.json for locale: de +0ms
verbose: i18n hook loaded successfully.
verbose: session hook loaded successfully.
verbose: Loading app Gruntfile...
verbose: Tracking new grunt child process...
verbose: grunt hook loaded successfully.
verbose: http hook loaded successfully.
verbose: Overriding ejs engine config with ejslocals to implement layout support...
verbose: Configuring socket (ws://) server...
verbose: sockets hook loaded successfully.
verbose: Loading user hooks...
verbose: Located 0 user hook(s)...
verbose: views hook loaded successfully.
verbose: Setting default Express view engine to ejs...
verbose: Initialized 0 user hook(s)...
verbose: userhooks hook loaded successfully.
verbose: Loading adapter ( sails-disk ) for sdm  from `node_modules` directory...
verbose: Starting ORM...
verbose: orm hook loaded successfully.
verbose: pubsub hook loaded successfully.
verbose: Built-in hooks are ready.
verbose: Instantiating registry...
verbose: Loading router...
verbose: Policy-controller bindings complete!
verbose: Waiting for all hooks to declare that they're ready...
verbose: All hooks were loaded successfully.
verbose: Starting app at C:\Users\myuser\git\datavis...
verbose: Running the setup logic in `sails.config.bootstrap(cb)`...
verbose: Restricting access to explicit host: 0.0.0.0
info:
info:
info:    Sails              <|
info:    v0.10.5             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------'
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info:
info: Server lifted in `C:\Users\myuser\git\datavis`
info: To see your app, visit http://0.0.0.0:8181
info: To shut down Sails, press <CTRL> + C at any time.

debug: --------------------------------------------------------
debug: :: Tue Oct 14 2014 09:04:11 GMT-0400 (Eastern Daylight Time)

debug: Environment : development
debug: Host        : 0.0.0.0
debug: Port        : 8181
debug: --------------------------------------------------------
verbose: Grunt :: Running "clean:dev" (clean) task
verbose: Grunt :: >> 191 paths cleaned.
verbose: Grunt :: Running "jst:dev" (jst) task
>> Destination not written because compiled files were empty.

Running "less:dev" (less) task
verbose: Grunt :: Running "copy:dev" (copy) task
verbose: Grunt :: Copied 178 files

Running "coffee:dev" (coffee) task
>> 0 files created.

Running "sails-linker:devJs" (sails-linker) task
padding length 4
File "views/layout.ejs" updated.

Running "sails-linker:devStyles" (sails-linker) task
padding length 4
File "views/layout.ejs" updated.

Running "sails-linker:devTpl" (sails-linker) task
padding length 4
File "views/layout.ejs" updated.

Running "sails-linker:devJsJade" (sails-linker) task

Running "sails-linker:devStylesJade" (sails-linker) task

Running "sails-linker:devTplJade" (sails-linker) task
verbose: Grunt :: Running "watch" task
Waiting...
verbose: Lowering sails...
verbose: Sent kill signal to child process (21060)...
verbose: Shutting down socket server...
verbose: Socket server shut down successfully.
verbose: Shutting down HTTP server...

5 comments
Comment actions Permalink

Does the issue only occur when debugging your application through the IDE? Try running it using Run button instead of Debug - does it work?

0
Comment actions Permalink

Very good call (and thanks for the speedy response). it does run the grunt stuff if I do a straight "run".  Does that give us a good clue for why it wouldn't be working in debug?

(update)   when debugging from the command line, it does still run the grunt things (node --debug=12345 app.js --verbose).

0
Comment actions Permalink

Most probably grunt is spawned as a child process using same debug port as a parent application... And, as the port is already bound, it's suspended
See https://github.com/Nodeclipse/nodeclipse-1/issues/146 for some hints

0
Comment actions Permalink

But as I read it, that would bind it up even when running in debug from the command line.  That's not the case here.  It still executes in debug from the command line, just not from withing webstorm.  Am I misinterpreting it?

0
Comment actions Permalink

you are running with --debug, not --debug-brk


0

Please sign in to leave a comment.