Skip to content

compile error zigbee2mqtt 2.7.2 #30508

@Epik77

Description

@Epik77

What happened?

pi@raspberrypi:/opt/zigbee2mqtt $ pnpm start

zigbee2mqtt@2.7.2 start /opt/zigbee2mqtt
node index.js

Starting Zigbee2MQTT without watchdog.
Building Zigbee2MQTT... (initial build), failed
Error: Command failed: pnpm run prepack

at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at ChildProcess.exithandler (node:child_process:417:12)
at ChildProcess.emit (node:events:519:28)
at maybeClose (node:internal/child_process:1101:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:519:28)
at Pipe.<anonymous> (node:net:346:12)

 ELIFECYCLE  Command failed with exit code 1.

What did you expect to happen?

Update/install latest version of Zigbee2MQTT

pi@raspberrypi:/opt/zigbee2mqtt $ pnpm run prepack

zigbee2mqtt@2.7.2 prepack /opt/zigbee2mqtt
pnpm run clean && pnpm run build

zigbee2mqtt@2.7.2 clean /opt/zigbee2mqtt
rimraf coverage dist tsconfig.tsbuildinfo

zigbee2mqtt@2.7.2 build /opt/zigbee2mqtt
tsc && node index.js writehash

lib/extension/bridge.ts:5:30 - error TS7016: Could not find a declaration file for module 'object-assign-deep'. '/opt/zigbee2mqtt/node_modules/.pnpm/object-assign-deep@0.4.0/node_modules/object-assign-deep/objectAssignDeep.js' implicitly has an 'any' type.
Try npm i --save-dev @types/object-assign-deep if it exists or add a new declaration (.d.ts) file containing declare module 'object-assign-deep';

5 import objectAssignDeep from "object-assign-deep";
~~~~~~~~~~~~~~~~~~~~
lib/extension/bridge.ts:753:9 - error TS2578: Unused '@ts-expect-error' directive.

753 // @ts-expect-error hidden from publish
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/extension/frontend.ts:11:26 - error TS7016: Could not find a declaration file for module 'finalhandler'. '/opt/zigbee2mqtt/node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/finalhandler if it exists or add a new declaration (.d.ts) file containing declare module 'finalhandler';

11 import finalhandler from "finalhandler";
~~~~~~~~~~~~~~

lib/extension/frontend.ts:13:23 - error TS7016: Could not find a declaration file for module 'ws'. '/opt/zigbee2mqtt/node_modules/.pnpm/ws@8.18.3/node_modules/ws/index.js' implicitly has an 'any' type.
If the 'ws' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ws'

13 import WebSocket from "ws";
~~~~

lib/extension/frontend.ts:158:56 - error TS7006: Parameter 'ws' implicitly has an 'any' type.

158 this.wss.handleUpgrade(request, socket, head, (ws) => {
~~

lib/extension/frontend.ts:172:25 - error TS7006: Parameter 'msg' implicitly has an 'any' type.

172 ws.on("error", (msg) => logger.error(WebSocket error: ${msg.message}));
~~~
lib/state.ts:3:30 - error TS7016: Could not find a declaration file for module 'object-assign-deep'. '/opt/zigbee2mqtt/node_modules/.pnpm/object-assign-deep@0.4.0/node_modules/object-assign-deep/objectAssignDeep.js' implicitly has an 'any' type.
Try npm i --save-dev @types/object-assign-deep if it exists or add a new declaration (.d.ts) file containing declare module 'object-assign-deep';

3 import objectAssignDeep from "object-assign-deep";
~~~~~~~~~~~~~~~~~~~~

lib/util/settings.ts:4:30 - error TS7016: Could not find a declaration file for module 'object-assign-deep'. '/opt/zigbee2mqtt/node_modules/.pnpm/object-assign-deep@0.4.0/node_modules/object-assign-deep/objectAssignDeep.js' implicitly has an 'any' type.
Try npm i --save-dev @types/object-assign-deep if it exists or add a new declaration (.d.ts) file containing declare module 'object-assign-deep';

4 import objectAssignDeep from "object-assign-deep";
~~~~~~~~~~~~~~~~~~~~

lib/util/settings.ts:368:17 - error TS2578: Unused '@ts-expect-error' directive.

368 // @ts-expect-error noMutate not typed properly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/util/settings.ts:480:5 - error TS2578: Unused '@ts-expect-error' directive.

480 // @ts-expect-error noMutate not typed properly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/util/utils.ts:7:30 - error TS7016: Could not find a declaration file for module 'humanize-duration'. '/opt/zigbee2mqtt/node_modules/.pnpm/humanize-duration@3.33.2/node_modules/humanize-duration/humanize-duration.js' implicitly has an 'any' type.
Try npm i --save-dev @types/humanize-duration if it exists or add a new declaration (.d.ts) file containing declare module 'humanize-duration';

7 import humanizeDuration from "humanize-duration";
~~~~~~~~~~~~~~~~~~~

lib/util/yaml.ts:5:35 - error TS7016: Could not find a declaration file for module 'js-yaml'. '/opt/zigbee2mqtt/node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/js-yaml if it exists or add a new declaration (.d.ts) file containing declare module 'js-yaml';

5 import yaml, {YAMLException} from "js-yaml";
~~~~~~~~~

lib/util/yaml.ts:13:14 - error TS2339: Property 'name' does not exist on type 'YAMLFileException'.

13 this.name = "YAMLFileException";
~~~~

lib/util/yaml.ts:14:14 - error TS2339: Property 'cause' does not exist on type 'YAMLFileException'.

14 this.cause = error.cause;
~~~~~

lib/util/yaml.ts:15:14 - error TS2339: Property 'message' does not exist on type 'YAMLFileException'.

15 this.message = error.message;
~~~~~~~

lib/util/yaml.ts:16:14 - error TS2339: Property 'stack' does not exist on type 'YAMLFileException'.

16 this.stack = error.stack;
~~~~~

node_modules/.pnpm/express-static-gzip@3.0.0/node_modules/express-static-gzip/index.d.ts:9:31 - error TS7016: Could not find a declaration file for module 'serve-static'. '/opt/zigbee2mqtt/node_modules/.pnpm/serve-static@2.2.0/node_modules/serve-static/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/serve-static if it exists or add a new declaration (.d.ts) file containing declare module 'serve-static';

9 import * as serverStatic from "serve-static";
~~~~~~~~~~~~~~

Found 17 errors in 7 files.

Errors Files
2 lib/extension/bridge.ts:5
4 lib/extension/frontend.ts:11
1 lib/state.ts:3
3 lib/util/settings.ts:4
1 lib/util/utils.ts:7
5 lib/util/yaml.ts:5
1 node_modules/.pnpm/express-static-gzip@3.0.0/node_modules/express-static-gzip/index.d.ts:9
 ELIFECYCLE  Command failed with exit code 2.
 ELIFECYCLE  Command failed with exit code 2.

How to reproduce it (minimal and precise)

git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
cd /opt/zigbee2mqtt
corepack enable
pnpm add -g typescript
pnpm i --production
pnpm start

Zigbee2MQTT version

2.7.2

Adapter firmware version

25.35.1

Adapter

EmberZNet 6.1.5

Setup

Raspberry 1B
node-v22.21.1-linux-armv6l
raspibian bookworm 12.12

Device database.db entry

No response

Debug log

No response

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    problemSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions