Melissa Melissa - 1 year ago 185
Node.js Question

How to use node-inspector with `npm start` for my application?

I am using

npm start
to start my MEAN stack application, but I would like to use the node-inspector to debug some Mongoose. I know I can start the node inspector with
, but what can I substitute
node --debug app.js
with to make
npm start
work in my case?

This is my MEAN stack directory structure:

HTML views/
Angular.js public/javascript/
Express.js routes/
Node.js app.js
Mongoose js models/, connected in app.js
Mongo db connected in app.js

For more information, this is my related question.

Answer Source

You may want to add a seperate debug script to package.json. That way you won't have to remember to revert npm start when you're finished debugging.

"scripts": {
    "start": "node ./bin/www",
    "debug": "node --debug ./bin/www"

Start with npm run:

$ npm run debug
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download