How to add Socketio.js to bench start

Hello all,

I have successfully installed bench and erpnext app on my bench. But I see this error in the terminal

/bin/sh: /usr/local/bin/node_apps/frappe/socketio.js: No such file or directory

I did install the socketio library using npm install socket.io but inside /usr/local/bin only node_modules folder exists and no node_apps/frappe/socketio.js

How do add this folder please

Thank you

My issue is related to not being able to upload images while running setup wizard. I did some search and came across a thread here where @rmehta said it is an issue with socketio setup.

I have socketio installed, which exists in /usr/local/bin/node_modules and he told the person who asked the question to try adding socketio to your bench start, but never gave a way to do it.

I ran bench setup socketio successfully, with the hope that this might be the problem but this folder /node apps/frappe/socketio.js does not exists in /usr/local/bin and throws error in the terminal.

Can anyone please tell me how to add socketio to bench start and is the node app/frape/socketio supposed to exists. If it doesnt exist, how can I get the file and add it manually by myself.

Thank you

Post the full traceback you get when you execute the command bench start

It seems like frappe isn’t installed well. You might have to manually create a file within frappe named socketio.js. This is technically the node server that frappe attempts to spawn.

Then try a bench start. Make sure your Procfile within your bench directory has socketio as one of its processes.

I would suggest reinstalling frappe in case there’s more errors.

➜ adnakSchools bench start
09:17:25 system | redis_socketio.1 started (pid=790)
09:17:25 system | worker_long.1 started (pid=789)
09:17:25 system | watch.1 started (pid=792)
09:17:25 system | redis_queue.1 started (pid=794)
09:17:25 system | web.1 started (pid=796)
09:17:25 system | schedule.1 started (pid=798)
09:17:25 system | worker_default.1 started (pid=799)
09:17:25 system | socketio.1 started (pid=800)
09:17:25 system | redis_cache.1 started (pid=801)
09:17:25 socketio.1 | /bin/sh: /usr/bin/node: No such file or directory
09:17:25 system | socketio.1 stopped (rc=127)
09:17:25 system | worker_short.1 started (pid=802)
09:17:25 system | sending SIGTERM to redis_socketio.1 (pid 790)
09:17:25 system | sending SIGTERM to worker_long.1 (pid 789)
09:17:25 system | sending SIGTERM to watch.1 (pid 792)
09:17:25 system | sending SIGTERM to redis_queue.1 (pid 794)
09:17:25 system | sending SIGTERM to web.1 (pid 796)
09:17:25 system | sending SIGTERM to schedule.1 (pid 798)
09:17:25 system | sending SIGTERM to worker_default.1 (pid 799)
09:17:25 system | sending SIGTERM to redis_cache.1 (pid 801)
09:17:25 system | sending SIGTERM to worker_short.1 (pid 802)
09:17:25 redis_socketio.1 | 790:C 23 Jan 09:17:25.174 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
09:17:25 redis_socketio.1 | 790:C 23 Jan 09:17:25.175 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=790, just started
09:17:25 redis_socketio.1 | 790:C 23 Jan 09:17:25.175 # Configuration loaded
09:17:25 redis_socketio.1 | 790:signal-handler (1516695445) Received SIGTERM scheduling shutdown…
09:17:25 system | web.1 stopped (rc=-15)
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.176 * Increased maximum number of open files to 10032 (it was originally set to 4864).
09:17:25 system | worker_long.1 stopped (rc=-15)
09:17:25 system | watch.1 stopped (rc=-15)
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.177 * Running mode=standalone, port=12000.
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.177 # Server initialized
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.177 * Ready to accept connections
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.177 # User requested shutdown…
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.177 * Removing the pid file.
09:17:25 redis_socketio.1 | 790:M 23 Jan 09:17:25.177 # Redis is now ready to exit, bye bye…
09:17:25 system | schedule.1 stopped (rc=-15)
09:17:25 system | redis_socketio.1 stopped (rc=0)
09:17:25 system | worker_short.1 stopped (rc=-15)
09:17:25 system | redis_cache.1 stopped (rc=-9)
09:17:25 system | redis_queue.1 stopped (rc=-15)
09:17:25 system | worker_default.1 stopped (rc=-15)

@achillesrasquinha

Thank you for your response.

You might have to manually create a file within frappe named socketio.js

I do not have the [node apps/frappe/socketio.js] inside my /usr/bin folder. Are you saying I should create the both the folder and the esocketio.js file. If yes, is the socketio.js file supposed to empty or do I copy socketio.js client library into it?

Thank you.

What’s node? Why is frappe within your /usr/bin directory?

This is the content of the Procfile @achillesrasquinha

I get you now.

/usr/local/bin/node is the node executable. apps/frappe/socketio.js is the path to socketio.js (frappe’s Node Server). (This is basically where you execute the bench command - within the bench instance. Your instance can be anywhere, you should ensure apps/frappe/socketio.js exists where you execute the command).

You should have node installed.

  1. node --version should provide you the version.

You should also have npm installed.

  • npm --version should do the same.

You should then have socketio-lib installed. You can execute the following command within your bench instance.

$ bench setup requirements

This goes ahead and installs all dependencies (Socket.IO being one - creates the node_modules folder where you’ve got your libs).

bench start

should then work.

@achillesrasquinha

Thank you. I am creating a new bench and will reinstall erpnext app on a new site.

Phew!

1 Like

:sweat_smile:

/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
00:28:58 system | socketio.1 started (pid=1191771)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
00:28:58 system | redis_cache.1 started (pid=1191750)
00:28:58 redis_cache.1 | 1191760:C 06 Jun 2021 00:28:58.914 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
00:28:58 redis_cache.1 | 1191760:C 06 Jun 2021 00:28:58.914 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1191760, just started
00:28:58 redis_cache.1 | 1191760:C 06 Jun 2021 00:28:58.914 # Configuration loaded
00:28:58 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:58.915 * Increased maximum number of open files to 10032 (it was originally set to 1024).
00:28:58 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:58.922 * Running mode=standalone, port=13000.
00:28:58 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:58.923 # Server initialized
00:28:58 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:58.923 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
00:28:58 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:58.923 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
00:28:58 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:58.923 * Ready to accept connections
00:28:58 system | watch.1 started (pid=1191770)
00:28:58 system | web.1 started (pid=1191790)
/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
00:28:58 system | worker_default.1 started (pid=1191776)
00:28:58 system | worker_short.1 started (pid=1191803)
00:28:58 system | redis_queue.1 started (pid=1191762)
00:28:58 redis_queue.1 | 1191768:C 06 Jun 2021 00:28:58.924 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
00:28:58 redis_queue.1 | 1191768:C 06 Jun 2021 00:28:58.924 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1191768, just started
00:28:58 redis_queue.1 | 1191768:C 06 Jun 2021 00:28:58.924 # Configuration loaded
00:28:58 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:58.925 * Increased maximum number of open files to 10032 (it was originally set to 1024).
00:28:58 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:58.939 * Running mode=standalone, port=11000.
00:28:58 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:58.939 # Server initialized
00:28:58 system | redis_socketio.1 started (pid=1191753)
00:28:58 redis_socketio.1 | 1191765:C 06 Jun 2021 00:28:58.927 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
00:28:58 redis_socketio.1 | 1191765:C 06 Jun 2021 00:28:58.927 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1191765, just started
00:28:58 redis_socketio.1 | 1191765:C 06 Jun 2021 00:28:58.927 # Configuration loaded
00:28:59 system | worker_long.1 started (pid=1191772)
00:28:58 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:58.928 * Increased maximum number of open files to 10032 (it was originally set to 1024).
00:28:58 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:58.938 * Running mode=standalone, port=12000.
00:28:58 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:58.938 # Server initialized
00:28:58 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:58.938 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
00:28:58 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:58.938 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
00:28:58 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:58.939 * Ready to accept connections
00:28:59 system | schedule.1 started (pid=1191817)
00:28:58 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:58.939 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
00:28:58 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:58.939 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
00:28:58 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:58.939 * Ready to accept connections
00:28:59 socketio.1 | internal/modules/cjs/loader.js:818
00:28:59 socketio.1 | throw err;
00:28:59 socketio.1 | ^
00:28:59 socketio.1 |
00:28:59 socketio.1 | Error: Cannot find module ‘socket.io
00:28:59 socketio.1 | Require stack:
00:28:59 socketio.1 | - /home/atif/frappe-bench/apps/frappe/socketio.js
00:28:59 socketio.1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
00:28:59 socketio.1 | at Function.Module._load (internal/modules/cjs/loader.js:667:27)
00:28:59 socketio.1 | at Module.require (internal/modules/cjs/loader.js:887:19)
00:28:59 socketio.1 | at require (internal/modules/cjs/helpers.js:74:18)
00:28:59 socketio.1 | at Object. (/home/atif/frappe-bench/apps/frappe/socketio.js:3:10)
00:28:59 socketio.1 | at Module._compile (internal/modules/cjs/loader.js:999:30)
00:28:59 socketio.1 | at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
00:28:59 socketio.1 | at Module.load (internal/modules/cjs/loader.js:863:32)
00:28:59 socketio.1 | at Function.Module._load (internal/modules/cjs/loader.js:708:14)
00:28:59 socketio.1 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
00:28:59 socketio.1 | code: ‘MODULE_NOT_FOUND’,
00:28:59 socketio.1 | requireStack: [ ‘/home/atif/frappe-bench/apps/frappe/socketio.js’ ]
00:28:59 socketio.1 | }
00:28:59 system | socketio.1 stopped (rc=1)
00:28:59 system | sending SIGTERM to redis_cache.1 (pid 1191750)
00:28:59 system | sending SIGTERM to redis_socketio.1 (pid 1191753)
00:28:59 system | sending SIGTERM to redis_queue.1 (pid 1191762)
00:28:59 system | sending SIGTERM to web.1 (pid 1191790)
00:28:59 system | sending SIGTERM to watch.1 (pid 1191770)
00:28:59 system | sending SIGTERM to schedule.1 (pid 1191817)
00:28:59 system | sending SIGTERM to worker_short.1 (pid 1191803)
00:28:59 system | sending SIGTERM to worker_long.1 (pid 1191772)
00:28:59 system | sending SIGTERM to worker_default.1 (pid 1191776)
00:28:59 redis_cache.1 | 1191760:signal-handler (1622919539) Received SIGTERM scheduling shutdown…
00:28:59 redis_socketio.1 | 1191765:signal-handler (1622919539) Received SIGTERM scheduling shutdown…
00:28:59 redis_queue.1 | 1191768:signal-handler (1622919539) Received SIGTERM scheduling shutdown…
00:28:59 system | web.1 stopped (rc=-15)
00:28:59 system | worker_default.1 stopped (rc=-15)
00:28:59 system | worker_short.1 stopped (rc=-15)
00:28:59 system | watch.1 stopped (rc=-15)
00:28:59 system | worker_long.1 stopped (rc=-15)
00:28:59 system | schedule.1 stopped (rc=-15)
00:28:59 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:59.427 # User requested shutdown…
00:28:59 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:59.427 * Removing the pid file.
00:28:59 redis_cache.1 | 1191760:M 06 Jun 2021 00:28:59.428 # Redis is now ready to exit, bye bye…
00:28:59 system | redis_cache.1 stopped (rc=-15)
00:28:59 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:59.440 # User requested shutdown…
00:28:59 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:59.440 * Removing the pid file.
00:28:59 redis_queue.1 | 1191768:M 06 Jun 2021 00:28:59.440 # Redis is now ready to exit, bye bye…
00:28:59 system | redis_queue.1 stopped (rc=-15)
00:28:59 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:59.442 # User requested shutdown…
00:28:59 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:59.442 * Removing the pid file.
00:28:59 redis_socketio.1 | 1191765:M 06 Jun 2021 00:28:59.442 # Redis is now ready to exit, bye bye…
00:28:59 system | redis_socketio.1 stopped (rc=-15)

I’m getting this type of error can you tell me how to solve this