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 node-inspector
, 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.
Using the Node. To connect to it, open up Google Chrome and enter about:inspect into the URL bar and press Enter. Afterward, you will be redirected to chrome://inspect/ and be presented with a list of available devices to debug. If successful, your screen should show something similar to the image below.
Run a cmd, enter the folder and type npm install . Type npm install node-inspector again.
If the "scripts" object does not define a "start" property, npm will run node server. js . Note that this is different from the default node behavior of running the file specified in a package's "main" attribute when evoking with node .
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
In package.json
modify the start
run command:
"scripts": {
"start": "node --debug app.js"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With