node.js debugging with node-inspector and forever.js

6k Views Asked by At

I am unable to debug node.js server when using forever.js. Is it not possible?

Exampel: forever start --debug server.js

1) Starts the server.js ok, but I am unable to debug with node-inspector.

2) forever.js as: forever start server.js Does not re-start the server - this is the core service of forever?

I am working on a mac.

Thanks Regards

3

There are 3 best solutions below

2
On

Starts the server.js ok, but I am unable to debug with node-inspector.

Forever does not support debug mode out of the box. You can get around it by asking forever to start a custom command:

$ forever -c 'node --debug' server.js

Does not re-start the server - this is the core service of forever?

I assume you would like to restart the server after a change in source files. I am not very familiar with forever, but I would say you forgot to add -w option to the command line?

    -w, --watch      Watch for file changes

To debug a process and have it automatically restarted, run

$ forever -w -c 'node --debug' server.js

See also this node-inspector issue: #196.

0
On

Debug using v8 in chrome

in terminal write:

node inspect server.js

navigate to chrome://inspect go to remote target inspect

0
On

Complete instructions on Windows with Chrome

In first terminal run

forever -w -c "node --debug" server.js

In second terminal run

node-inspector

Navigate to localhost:8080