Update script should retry npm dependency install after Arborist edgesOut crash
Summary
The hosted update script can fail the whole ClawRouter update when its post-install dependency fill step hits an npm Arborist internal error:
npm error Cannot read properties of null (reading 'edgesOut')
The failing command was from the live update flow used by:
curl -fsSL https://blockrun.ai/ClawRouter-update | bash
Observed failure
Environment from the failing testbed run:
Node: v22.23.1
npm: 10.9.8
ClawRouter package: @blockrun/[email protected]
cwd: ~/.openclaw/npm/projects/.../node_modules/@blockrun/clawrouter
command: npm install --omit=dev
The npm debug log ended with:
TypeError: Cannot read properties of null (reading 'edgesOut')
at #loadPeerSet (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js:1289:38)
at async #buildDepStep (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:11)
at async Arborist.buildIdealTree (.../@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
at async Arborist.reify (.../@npmcli/arborist/lib/arborist/reify.js:133:5)
The same log shows npm resolving dev/peer metadata such as vitest, @vitest/browser-*, playwright, and webdriverio even though the command was --omit=dev. It appears to be npm's peer-dependency resolver crashing while building the ideal tree, not a ClawRouter runtime error.
A direct global install did not hit this failure on the same host:
npm install -g @blockrun/clawrouter
That succeeded. The risky path is specifically the update script's nested install inside the already-installed package directory:
cd "$ACTIVE_PACKAGE_DIR" && npm install --omit=dev
Why this matters
The update script currently treats this npm internal resolver crash as fatal and rolls back the whole installation. Users running the hosted script on an affected npm version can fail to install/update ClawRouter even though the package itself is installable.
Suggested guardrail
Keep the normal install path first, but retry with npm's legacy peer resolver when npm hits this class of internal Arborist failure:
npm install --omit=dev --no-audit --no-fund
If that fails and the log contains the Arborist/internal error, retry:
npm install --omit=dev --legacy-peer-deps --no-audit --no-fund
Only fail the update if both attempts fail.
This would keep the default behavior unchanged for healthy npm versions while preventing npm resolver bugs from aborting the full ClawRouter installation/update path.
Update after retesting on the same testbed with upgraded Node/npm:
Node: v24.20.0
npm: 11.19.0
The hosted update script no longer reproduces the edgesOut Arborist crash on that stack. The post-install dependency step completed successfully:
added 180 packages, removed 1 package, and audited 511 packages in 50s
So this appears to be npm-version-specific behavior observed with:
Node: v22.23.1
npm: 10.9.8
The guardrail suggestion still applies as a defensive fallback for users who hit npm 10/Arborist resolver crashes, but this should not be read as currently reproducible on Node 24/npm 11.