Running nodemon --inspect index.js or nodemon --debug index.js doesn't work.
Node Version : 8.9.1
Nodemon Version : 1.12.6
I have tried these with no luck :
nodemon --inspect-brk index.jsnodemon -- --inspect index.jsnodemon index.js -- --inspect index.jsnodemon index.js -- --debug index.jsnodemon -- --debug index.jsnodemon --inspect --debug index.jsnodemon --debug-brk index.js
But node --inspect index.js or node --inspect-brk index.js works. I wonder how? If any alternatives or some kinda workaround would be great too.
2Please comment if you need further description.
5 Answers
For people coming from search engines, there could be a bug related to nodemon and ts-node.
Error: Unknown or unexpected option: --inspectThis can be a way to use inspect with nodemon:
nodemon --exec 'node --inspect=0.0.0.0:9229 --require ts-node/register src/index.ts'For more information see here
SOLVED,
It seems like nodemon@1.12.6 was not passing in this argument. There is a newer version available 1.12.7 where everything works fine and well.
Answer source: Nodemon Issues - Github
0nodemon --inspect app.jsThe .js part is absolutely necessary.
FINALLY SOLVED
Just follow the below steps are you're good to go:
Make sure you have updated version of nodemon. Update is using following command:
npm i nodemon@2.0.4 -g. Make sure to use-g(to give nodemon permissions to run as an administrator). If you get some warnings, try running the same with sudo commandsudo npm i nodemon@2.0.4 -gThen execute the command as:
nodemon --inspect app.js
I hope it helped..!!
As per official doc Nodemon NPM
You can also pass the inspect flag to node through the command line as you would normally:
2nodemon --inspect ./server.js 80