Reputation: 2263
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.js
nodemon -- --inspect index.js
nodemon index.js -- --inspect index.js
nodemon index.js -- --debug index.js
nodemon -- --debug index.js
nodemon --inspect --debug index.js
nodemon --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.
Please comment if you need further description.
Upvotes: 48
Views: 55643
Reputation: 635
for anyone who is having error ARG_UNKNOWN_OPTION specially with typescript ts-nod
and when using auto attach debugger in vscode
example with other arguments like dotenv
nodemon -r dotenv/config ./src/index.ts -- --inspect
Upvotes: 3
Reputation: 19
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 [email protected] -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 command sudo npm i [email protected] -g
Then execute the command as: nodemon --inspect app.js
I hope it helped..!!
Upvotes: 1
Reputation: 1774
For people coming from search engines, there could be a bug related to nodemon and ts-node.
Error: Unknown or unexpected option: --inspect
This 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
Upvotes: 51
Reputation: 301
As per official doc Nodemon NPM
You can also pass the inspect flag to node through the command line as you would normally:
nodemon --inspect ./server.js 80
Upvotes: 0
Reputation: 2263
SOLVED,
It seems like [email protected]
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
Upvotes: 19