Had a problem with starting zigbee2mqtt on my raspberry pi zero w v1.1 after updating zigbee2mqtt.
Building Zigbee2MQTT... (initial build), failed
Build failed; ran out-of-memory, free some memory (RAM) and start again
(node:2609) UnhandledPromiseRejectionWarning: Error: Command failed: npm run build
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Aborted
npm ERR! code 134
npm ERR! path /opt/zigbee2mqtt
npm ERR! command failed
npm ERR! command sh -c tsc && node index.js writehash
npm ERR! A complete log of this run can be found in:
npm ERR! /home/maarten/.npm/_logs/2022-04-05T14_22_40_107Z-debug.log
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
(node:2609) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2609) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Turns out I had to do the initial start with:
export NODE_OPTIONS=--max_old_space_size=256
npm start
This sets a lower memory limit for node so it will not go OOM.
After this there was no problem to start zigbee2mqtt like normal.
github