zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

suite of issue #26937

Open steflp opened this issue 1 year ago • 7 comments

What happened?

https://github.com/Koenkk/zigbee2mqtt/issues/26937

Hello
I try to update from 2.1.3 to 2.2.1 I update node js to 22.14 ( #nodejs -v) but when I start my zigbee alone ( with this command #pnpm start my system work fine .

When I want to start it with systemctl
I ve these error

avril 14 22:07:14 meteo-Ubuntu pnpm[143133]: > [email protected] start /opt/zigbee2mqtt
avril 14 22:07:15 meteo-Ubuntu pnpm[143150]: TypeError: Module "file:///opt/zigbee2mqtt/package.json" needs an import assertion of type "json"
avril 14 22:07:15 meteo-Ubuntu systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
avril 14 22:07:15 meteo-Ubuntu systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.

I give you my systemctl file :

[Unit]
Description=zigbee2mqtt
After=network.target

[Service]
Environment=NODE_ENV=production
ExecStart=/usr/local/bin/npm start
WorkingDirectory=/opt/zigbee2mqtt
StandardOutput=inherit
systemd.exec(5)
StandardError=inherit
Restart=always
RestartSec=10s

[Install]
WantedBy=multi-user.target

I roll back my config to 2.1.3 and its wordk fine

What did you expect to happen?

No response

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.2.1

Adapter firmware version

20250321

Adapter

SonOff Zlb 06 Zlb06M

Setup

Works on Ubuntu 22.04

Debug log

No response

steflp avatar Apr 14 '25 20:04 steflp

Any chance you have two node versions installed and your systemctl is triggering with the wrong one?

  • node --version
  • /usr/local/bin/node --version (or somewhere else)

Note: you can replace the cmd to be more direct (once you know the proper node path): ExecStart=node index.js

Nerivec avatar Apr 15 '25 18:04 Nerivec

root@meteo-Ubuntu:/home/stef# node -v v22.11.0

root@meteo-Ubuntu:/home/stef# nodejs -v v22.14.0

perhaps this ?

steflp avatar Apr 15 '25 18:04 steflp

#nvm ls-remote #nvm install 22.14.0

root@meteo-Ubuntu:~# node -v v22.14.0

steflp avatar Apr 15 '25 19:04 steflp

Did u try to use in systemctl file

ExecStart=/usr/bin/node index.js

instead of

ExecStart=/usr/local/bin/npm start

nstefy avatar Apr 18 '25 21:04 nstefy

Hello Sorry no time at the moment to test this ;-( sorry Possible to suspend ? Thanks

steflp avatar Apr 18 '25 21:04 steflp

OK , I take few minutes to upgrade from 2.1.3 to 2.2.1 and now is OK but with nodejs (???)

`root@meteo-Ubuntu:/opt/zigbee2mqtt-LAN2TEST# nodejs -v v22.14.0 root@meteo-Ubuntu:/opt/zigbee2mqtt-LAN2TEST# which nodejs /usr/bin/nodejs root@meteo-Ubuntu:/opt/zigbee2mqtt-LAN2TEST# cat /etc/systemd/system/zigbee2mqttLAN2.service [Unit] Description=zigbee2mqttLAN2 After=network.target

[Service] Environment=NODE_ENV=production ExecStart=/usr/bin/nodejs index.js WorkingDirectory=/opt/zigbee2mqtt-LAN2TEST StandardOutput=inherit StandardError=inherit Restart=always RestartSec=10s #User=steflp

[Install] WantedBy=multi-user.target root@meteo-Ubuntu:/opt/zigbee2mqtt-LAN2TEST#`

steflp avatar Apr 18 '25 22:04 steflp

all my zigbee is uptodate to 2.2.1 with nodejs 22.14

steflp avatar Apr 19 '25 19:04 steflp