You can launch the Node.js debugger when working with Node.js inside phpStorm
/bin/node --inspect-brk=0.0.0.0:50407 /var/www/example.js Debugger listening on ws://0.0.0.0:50407/49a2d585-05b1-438e-a53c-6b2943c684df For help, see: https://nodejs.org/en/docs/inspector Debugger attached.
This also starts the node inspector you can open in Google Chrome, but it uses a random port every time you relaunch the debugger. This may be an issue if you need to configure port forwarding and need the port to be fixed. For that, pass the --inspect flag:
- Go to debugger settings: click the debug dropdown in the top right toolbar (Select Run/Debug Configuration) - Click Edit Configurations
- Under Node Parameters add
--inspect=9229to use the default 9229 port