homebridge-config-ui-x: Version 4.51.1/4.51.2 does not fix bug and `rebuild` doesn't work

Describe The Bug

After the update to 4.51.1, Homebridge UI is not running. Rebuilding it fails with:

username@raspberrypi:~ $ sudo hb-service rebuild
ℹ Rebuilding for Node.js v18.18.2...
node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module './es6/validate-engines.js'
Require stack:
- /opt/homebridge/lib/node_modules/npm/lib/cli.js
- /opt/homebridge/lib/node_modules/npm/bin/npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/opt/homebridge/lib/node_modules/npm/lib/cli.js:1:25)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/homebridge/lib/node_modules/npm/lib/cli.js',
    '/opt/homebridge/lib/node_modules/npm/bin/npm-cli.js'
  ]
}

Node.js v18.18.2
node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module './es6/validate-engines.js'
Require stack:
- /opt/homebridge/lib/node_modules/npm/lib/cli.js
- /opt/homebridge/lib/node_modules/npm/bin/npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/opt/homebridge/lib/node_modules/npm/lib/cli.js:1:25)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/homebridge/lib/node_modules/npm/lib/cli.js',
    '/opt/homebridge/lib/node_modules/npm/bin/npm-cli.js'
  ]
}

Node.js v18.18.2
Error: Command failed: npm rebuild --unsafe-perm
✖ ERROR: Failed Operation

I could only fix it by running sudo apt-get reinstall homebridge but now the version is downgraded again.

Logs

[27/10/2023, 14:12:28] [Homebridge UI] Error: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/node_modules/@homebridge/node-pty-prebuilt-multiarch/build/Release/pty.node: cannot open shared object file: No such file or directory
[27/10/2023, 14:12:28] [Homebridge UI] [node-pty] Node.js v18.18.2
[27/10/2023, 14:12:28] [Homebridge UI] [node-pty] Failed to load node-pty module
[27/10/2023, 14:12:28] [Homebridge UI] [node-pty] This could be because the installation of this plugin did not complete successfully or you may have recently upgraded Node.js to a new major version.
[27/10/2023, 14:12:28] [Homebridge UI] [node-pty] Follow the steps below to resolve this issue.
[27/10/2023, 14:12:28] [Homebridge UI] [node-pty] Trying to rebuild automatically...
[27/10/2023, 14:12:28] [Homebridge UI] [node-pty] Path: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/node_modules/@homebridge/node-pty-prebuilt-multiarch
[27/10/2023, 14:12:29] [Homebridge UI] [node-pty] Failed to rebuild npm modules automatically. Manual operation is now required.
[27/10/2023, 14:12:29] [Homebridge UI] [node-pty] From the terminal run this command to rebuild npm modules:

[27/10/2023, 14:12:29] [Homebridge UI] sudo hb-service rebuild

[27/10/2023, 14:12:29] [HB Supervisor] ERROR: The user interface threw an unhandled error
Error: Node.js global modules rebuild required. See log errors above.
    at main (/opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/main.js:29754:19)
    at 1808 (/opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/main.js:29806:1)
    at __webpack_require__ (/opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/main.js:30138:42)
    at /opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/main.js:30166:1
    at /opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/main.js:30272:3
    at Object.<anonymous> (/opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/main.js:30277:12)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)

Config

No response

Homebridge UI Version

Former: 4.51.1 After rebuild: homebridge-config-ui-x v4.50.6

Homebridge Version

v1.6.1

Node.js Version

v18.18.2

Operating System

Raspberry Pi OS / Raspbian

Environment Info

  • Using Docker?
  • Using Hyper-V?
  • Using hb-service?

Raspberry Pi Model

Raspberry Pi 3 A+

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 34 (12 by maintainers)

Most upvoted comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Tks very much for confirming

Yes, probably the same underlying cause. I just wanted to highlight that rebuild is not working. I would assume that it is related to the fact that strings /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIBCXX is giving me strings: '/usr/lib/arm-linux-gnueabihf/libstdc++.so.6': No such file. However, some sort of GLIBCXX should be installed as sudo dpkg -l | grep libc6 gives me

ii  libc6:arm64                          2.31-13+rpt2+rpi1+deb11u7        arm64        GNU C Library: Shared libraries
ii  libc6-dbg:arm64                      2.31-13+rpt2+rpi1+deb11u7        arm64        GNU C Library: detached debugging symbols
ii  libc6-dev:arm64                      2.31-13+rpt2+rpi1+deb11u7        arm64        GNU C Library: Development Libraries and Header Files

(But this is beyond my knowledge of RPi)