How to use node-inspector with `npm start` for my application?
12,024
Solution 1
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
Solution 2
In package.json
modify the start
run command:
"scripts": {
"start": "node --debug app.js"
}
Author by
Melissa
I want to learn and understand why and how. Software is fascinating.
Updated on July 16, 2022Comments
-
Melissa almost 2 years
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 withnode-inspector
, but what can I substitutenode --debug app.js
with to makenpm 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.
-
Melissa over 8 yearsHi Moogs, thanks for your reply. Currently in my
"scripts"
it has:"start": "node ./bin/www"
. What should I do to change it? -
Miguel Mota over 8 years@Melissa try adding the
--debug
flag:node --debug ./bin/www
-
HASNEN LAXMIDHAR over 5 yearsDeprecationWarning:
node --debug
andnode --debug-brk
are invalid. Please usenode --inspect
ornode --inspect-brk
instead.