1

We can debug an app in nodeJs using Syntax : node-debug app.js But how can I debug using nodemon I tried nodemon --debug app.js but its not working. please help me how to debug using nodemon Thanks in advance :)

maulik sakhare
  • 1,957
  • 1
  • 12
  • 19

1 Answers1

1

Currently, "--debug" is deprecated, instead use "--inspect".

Simply type: $ nodemon --inspect app.js

You'll see the output like so:

[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node --inspect server.js`
Debugger listening on ws://127.0.0.1:9229/26849510-cfac-4aae-8dc0-8d9883809ba5
For help, see: https://nodejs.org/en/docs/inspector  
Debugger attached...  

To open the GUI debugger, open Chrome browser and type in the URL field:

[ chrome://inspect#devices ]

You'll see at the bottom of the opened page:

[  Remote Target
   #LOCALHOST
   Target (v12.18.3)  trace
   app.js
   file:///[your local path of the app.js    ]
   inspect

click to inspect you'll see the debugger ... enjoy it ...

anihoyan
  • 11
  • 4