Search code examples
node.jsherokunode-inspectornodemon

How do I get node-inspector to run with foreman and nodemon?


I have my heroku config vars in my .env file, so I have to use foreman to run my app locally. I need to debug using node-inspector, and I would like to not have to restart my app manually, so I would also like to use nodemon.

How do I use nodemon, node-inspector and foreman together?


Solution

  • It's simple really, just chain them all together in one command.

    # start node-inspector in the background
    $ node-inspector &
    
    # make nodemon execute foreman with debugging options enabled for app.js with
    ## either
    $ nodemon --exec "foreman run node --debug-brk app.js"
    ## or
    $ nodemon --exec "foreman run node --debug app.js"
    

    And you're done!