/home/areeb/frappe-bench/apps/frappe/socketio.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:85:18)
at Object. (/home/areeb/frappe-bench/apps/frappe/realtime/index.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [
‘/home/areeb/frappe-bench/apps/frappe/realtime/index.js’,
‘/home/areeb/frappe-bench/apps/frappe/socketio.js’
]
}
I found node command in supervisor configuration is wrong,
bench launch socketio.js with system node and not user node
For example ubuntu 22 ships with node v12 at usr/bin/node, but in supervisor bench use the system one instead the one that you installed as v18 or v20.
command=/usr/bin/node /home/ubuntu/frappe-15/apps/frappe/socketio.js
I fixed by editing supervisor config
### FIX Node Path in Supervisor ###
which node
sudo nano /etc/supervisor/conf.d/frappe-15.conf
[program:frappe-15-node-socketio]
#command=/usr/bin/node /home/ubuntu/frappe-15/apps/frappe/socketio.js
command=/home/ubuntu/.nvm/versions/node/v18.20.5/bin/node /home/ubuntu/frappe-15/apps/frappe/socketio.js