Pramesh Bajracharya
Pramesh Bajracharya

Reputation: 2263

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 :

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

Answers (6)

khierl
khierl

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

Ashwin Panwar
Ashwin Panwar

Reputation: 19

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 [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

  2. Then execute the command as: nodemon --inspect app.js

I hope it helped..!!

Upvotes: 1

Sir hennihau
Sir hennihau

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

Nikhil Vats
Nikhil Vats

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

Charlie
Charlie

Reputation: 23768

nodemon --inspect app.js

The .js part is absolutely necessary.

Upvotes: 16

Pramesh Bajracharya
Pramesh Bajracharya

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

Related Questions