Can't get Socketio to start

I installed Node through npm. I’ve installed version v18.19.1. I’ve installed ERPNext 15.

Just can’t get my head around what is causing this issue.

Below the error from Bench start:

~/frappe-bench$ bench start
02:09:54 system        | redis_cache.1 started (pid=35002)
02:09:54 system        | redis_queue.1 started (pid=35005)
02:09:54 system        | web.1 started (pid=35009)
02:09:54 redis_cache.1 | 35007:C 15 Feb 2024 02:09:54.153 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
02:09:54 redis_cache.1 | 35007:C 15 Feb 2024 02:09:54.154 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=35007, just started
02:09:54 redis_cache.1 | 35007:C 15 Feb 2024 02:09:54.154 # Configuration loaded
02:09:54 redis_cache.1 | 35007:M 15 Feb 2024 02:09:54.155 * Increased maximum number of open files to 10032 (it was originally set to 1024).
02:09:54 system        | socketio.1 started (pid=35015)
02:09:54 redis_cache.1 | 35007:M 15 Feb 2024 02:09:54.161 * Running mode=standalone, port=6377.
02:09:54 redis_cache.1 | 35007:M 15 Feb 2024 02:09:54.162 # Server initialized
02:09:54 redis_cache.1 | 35007:M 15 Feb 2024 02:09:54.162 # 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.
02:09:54 system        | watch.1 started (pid=35016)
02:09:54 redis_cache.1 | 35007:M 15 Feb 2024 02:09:54.165 * Ready to accept connections
02:09:54 system        | schedule.1 started (pid=35017)
02:09:54 system        | worker.1 started (pid=35021)
02:09:54 redis_queue.1 | 35011:C 15 Feb 2024 02:09:54.192 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
02:09:54 redis_queue.1 | 35011:C 15 Feb 2024 02:09:54.200 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=35011, just started
02:09:54 redis_queue.1 | 35011:C 15 Feb 2024 02:09:54.201 # Configuration loaded
02:09:54 redis_queue.1 | 35011:M 15 Feb 2024 02:09:54.204 * Increased maximum number of open files to 10032 (it was originally set to 1024).
02:09:54 redis_queue.1 | 35011:M 15 Feb 2024 02:09:54.208 * Running mode=standalone, port=6378.
02:09:54 redis_queue.1 | 35011:M 15 Feb 2024 02:09:54.209 # Server initialized
02:09:54 redis_queue.1 | 35011:M 15 Feb 2024 02:09:54.213 # 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.
02:09:54 redis_queue.1 | 35011:M 15 Feb 2024 02:09:54.215 * Ready to accept connections
02:09:54 socketio.1    | /home/frappe-user/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/index.js:35
02:09:54 socketio.1    |             modules: extensions?.modules,
02:09:54 socketio.1    |                                 ^
02:09:54 socketio.1    | 
02:09:54 socketio.1    | SyntaxError: Unexpected token '.'
02:09:54 socketio.1    |     at wrapSafe (internal/modules/cjs/loader.js:915:16)
02:09:54 socketio.1    |     at Module._compile (internal/modules/cjs/loader.js:963:27)
02:09:54 socketio.1    |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
02:09:54 socketio.1    |     at Module.load (internal/modules/cjs/loader.js:863:32)
02:09:54 socketio.1    |     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
02:09:54 socketio.1    |     at Module.require (internal/modules/cjs/loader.js:887:19)
02:09:54 socketio.1    |     at require (internal/modules/cjs/helpers.js:74:18)
02:09:54 socketio.1    |     at Object.<anonymous> (/home/frappe-user/frappe-bench/apps/frappe/node_modules/@redis/client/dist/index.js:18:18)
02:09:54 socketio.1    |     at Module._compile (internal/modules/cjs/loader.js:999:30)
02:09:54 socketio.1    |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
02:09:54 system        | socketio.1 stopped (rc=1)
02:09:54 system        | sending SIGTERM to redis_cache.1 (pid 35002)
02:09:54 system        | sending SIGTERM to redis_queue.1 (pid 35005)
02:09:54 system        | sending SIGTERM to web.1 (pid 35009)
02:09:54 system        | sending SIGTERM to watch.1 (pid 35016)
02:09:54 system        | sending SIGTERM to schedule.1 (pid 35017)
02:09:54 system        | sending SIGTERM to worker.1 (pid 35021)
02:09:54 redis_queue.1 | 35011:signal-handler (1707959394) Received SIGTERM scheduling shutdown...
02:09:54 redis_cache.1 | 35007:signal-handler (1707959394) Received SIGTERM scheduling shutdown...
02:09:55 system        | worker.1 stopped (rc=-15)
02:09:55 system        | web.1 stopped (rc=-15)
02:09:55 system        | watch.1 stopped (rc=-15)
02:09:55 system        | schedule.1 stopped (rc=-15)
02:09:55 redis_queue.1 | 35011:M 15 Feb 2024 02:09:55.020 # User requested shutdown...
02:09:55 redis_queue.1 | 35011:M 15 Feb 2024 02:09:55.020 * Removing the pid file.
02:09:55 redis_queue.1 | 35011:M 15 Feb 2024 02:09:55.020 # Redis is now ready to exit, bye bye...
02:09:55 system        | redis_queue.1 stopped (rc=-15)
02:09:55 redis_cache.1 | 35007:M 15 Feb 2024 02:09:55.068 # User requested shutdown...
02:09:55 redis_cache.1 | 35007:M 15 Feb 2024 02:09:55.068 * Removing the pid file.
02:09:55 redis_cache.1 | 35007:M 15 Feb 2024 02:09:55.068 # Redis is now ready to exit, bye bye...
02:09:55 system        | redis_cache.1 stopped (rc=-15)

When I run sudo supervisorctl start all it nicely shows all started, but quickly shows the following issue when doing status:
frappe-bench-web:frappe-bench-node-socketio BACKOFF Exited too quickly (process log may have details)

In the log it complains about the same issues with ?. etc.

I’m curious whether I might have setup Node wrongly, or have something with my system screwing up the files. I just cant get it to work.

EDIT:
Additional, this is the log when I start it:

home/frappe-user/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/index.js:35
            modules: extensions?.modules,
                                ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    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)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/frappe-user/frappe-bench/apps/frappe/node_modules/@redis/client/dist/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
/home/frappe-user/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/index.js:35
            modules: extensions?.modules,

1 Like

One of the requirements may be missing, try

cd ~/frappe-bench
bench setup requirements
1 Like

Hi… I have the same issue; run bench setup requirements but still having the same error…

There’s another thread on this issue:

But my node is already at v21

this help:

$ bench doctor
$ bench update --requirements
$ bench setup socketio
$ bench setup redis
$ bench retry-upgrade
$ sudo supervisorctl restart
$ sudo service nginx restart

First of all to find out route cause of this issue check your “node-socketio.error.log” file.
In my case issue was,

Blockquote
modules: extensions?.modules,
^
SyntaxError: Unexpected token ‘.’

This means the version of node installed is older than <= 14.

To check node version you can do “node -v”. If its older then update it to version >=16.

Even after doing this if same error is coming that means the node installation used in supervisor config is different than you have just updated.

To check node installation path of your supervisor open “supervisor.conf” file.

Where you will find,

[program:frappe-bench-node-socketio]

Below this line you will find the path of node wich is being used to compile the redis js.
Change this path to your latest node version installation and after it run
“sudo systemctl restart supervisor”.
After this command the issue will be resolved

1 Like