ERROR at bench update

This came up in the history on the forum, though, I could not find an actual solution…
Whenever I perform a bench update I get an error at the end from supervisorctl:

$ sudo supervisorctl restart frappe-bench-web:
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: ERROR (spawn error)
ERROR: sudo supervisorctl restart frappe-bench-web:
subprocess.CalledProcessError: Command 'sudo supervisorctl restart frappe-bench-web:' returned non-zero exit status 7.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/update.py", line 59, in update
    update(
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 488, in update
    bench.reload(web=False, supervisor=restart_supervisor, systemd=restart_systemd)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 152, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web, _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 342, in restart_supervisor_processes
    failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 178, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: sudo supervisorctl restart frappe-bench-web:

the frappe-bench-web:frappe-bench-node-socketio: ERROR (spawn error) also happens when I just do sudo supervisorctl restart all.
I tried:

$ sudo npm install express
$ sudo npm install socket.io

as suggested here, with no success.
It’s more of an annoiance, than a problen, but I would like to make it go away…

check if something is holding a port open and kill the process manually
ss -antlp will show which ports are in use.
If supervisor is stuck, normally 11000,12000,13000 would be in use (but no guarantees).
You might need to use kill -9 <PID> once you’ve identified the PID from the stuck port

Check Supervisor Configuration : Ensure that the Supervisor configuration for frappe-bench-node-socketio is correctly set up. You can check the configuration file usually located in /etc/supervisor/conf.d/ directory to see if there are any errors or misconfigurations

I think that bench is the only one using these ports…

Well I saw that the error log is:

/home/frappe/frappe-bench/logs/node-socketio.error.log

so I take a look, and here is what I see:


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/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/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/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)

FYI, this is a clean Ubuntu installation and a clean bench installation, with only a new site and a new app (no ERPNext).
Tried removing the . on line 35 of the file: /home/frappe/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/index.js and got an unexpected tocken ‘,’ error at the same line instead… :thinking:

Try These

Check Node.js Version

(Node.js 14 or later). Y

node -v

Upgrade Node.js:

If your Node.js version is older than 14, you need to upgrade it.

bash

nvm install 14

 nvm use 14

Update Dependencies:

cd /home/frappe/frappe-bench

npm install

Using node 18.20.3
As per These instructions (also made my own installation script, so that’s definitely not it ¯\(ツ)/¯ ).

Check this.

Still the same.
:man_facepalming:t5:

Can you Share me the screen shot of the changes you made in your terminal after seeing my 1st reply?

Hi,

run the command following command one more time.

sudo bench setup production <frappe-user>

Replace the with your actual username.

Thanks,

Divyesh Mangroliya


also @mangroliya I did sudo bench setup production frappe, but no success.
I really don’t get it.
I did everything “by the book”, and technically, everything seems to be working fine…
I am baffled.

@abrefael

Hey man, sorry for opening the thread but have you found any solution?

I’m facing the same error when trying to setup the bench for production.

I would appreciate any help.

Thank you

Can you reinstall from scratch?
If so, you can try and use this to install frappe-bench+erpNext and\or any other apps (supply their git repository URL).
This also fixes the error during the process (I admit, I don’t remember what I did to fix the issue, but I know it does not appear when using the script).
Make sure you use Ubuntu 22.04.4 installer and don’t update the installer during installation.
Good luck~ :slight_smile:

1 Like

Well, I guess there’s also this… that I already answered…
:flushed::man_facepalming:t4:

1 Like

I will try it RN.
Thanks man <3