Nodemon Inspect/Debug Not Working?

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.

2

5 Answers

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

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

0
nodemon --inspect app.js

The .js part is absolutely necessary.

FINALLY SOLVED

Just follow the below steps are you're good to go:

  1. 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 command sudo npm i nodemon@2.0.4 -g

  2. Then 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:

nodemon --inspect ./server.js 80

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest