[solution] 502 bad gateway for socketio network calls


I was troubleshooting a frappe version-14 installation where node-socketio wasn’t working. I checked discuss forum and the solutions didn’t help my case.

After some digging around, found one the issue.

  • node-socketio wasn’t listening on port 9000
  • npm dependencies were correctly installed for frappe app
  • node and npm was installed using nvm in production user
  • socketio config was getting added to nginx.conf
  • no relevant errors in frappe-bench/logs folder
  • its config section was missing from supervisor.conf
  • bench setup socketio didn’t help; Anyways it was deprecated.

While looking into source code of bench, found that a variable node was being referred in template for supervisor.conf. This variable was derived by checking presence of node. This wasn’t going work in the troubled installation because node wasn’t installed in root user.


  1. run bench setup supervisor - this command is run without sudo and hence will be able to detect node installation correctly.
  2. install node in root user and make sure that it gets added to path when a command is run as sudo. After that, run sudo bench setup production frappe


  1. rectified from bench setup supervisor to bench setup socketio in troubleshooting steps
  2. mentioned frappe version




thanks, for me this happen when installing node with nvm because bench setup expect to find node in /usr/bin/node but nvm install node in different place

1 Like

You might have multiple node versions installed? one is system package (apt) and nvm is separate maybe?

1 Like

simply we can create symbolic link to the nvm/npm to /usr/bin to fix this problem, you can read my guide for that:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.