Skip to content

fix: stop forcing a conflicting system Node.js package - #3

Open
pkeenan87 wants to merge 1 commit into
bitshaker:mainfrom
pkeenan87:fix/node-runtime-conflict
Open

pkeenan87 wants to merge 1 commit into
bitshaker:mainfrom
pkeenan87:fix/node-runtime-conflict

Conversation

@pkeenan87

Copy link
Copy Markdown

Setup cannot complete when nodejs is installed

Setup installs nodejs-lts-jod through pacman -S --noconfirm. On any machine that already has the nodejs package that is an unresolvable conflict — the two packages conflict, and --noconfirm cannot answer the replacement prompt:

:: nodejs-lts-jod-22.23.2-1 and nodejs-26.8.1-2 are in conflict
Setup did not complete; correct the problem and try again.

Two things make this worse than it first looks:

  • nodejs is commonly a dependency, not a choice. On the machine I hit this on it was pulled in by cursor-bin. The user never picked a Node version, and the plugin asks them to swap a system package to install a camera plugin.
  • It recurs. Every time Arch's nodejs moves past the supported 20/22/24 window, this returns. --noconfirm can never resolve a package conflict, so the current code has no path out.

Skipping the package does not help either — verify_runtime then rejects the system Node and exits.

What this changes

Resolve the runtime instead of dictating it:

  • Drop nodejs-lts-jod and npm from the pacman list.
  • Reuse the system runtime whenever it is Node.js 20, 22, or 24.
  • Otherwise install the pinned Node.js 22.23.2 LTS privately under ~/.local/share/omarchy-ring/node/, verified against its published SHA-256 checksum over HTTPS. This mirrors how go2rtc is already installed, and the tarball bundles npm, so the npm package is no longer needed either.
  • Point the units and the panel at a ~/.local/bin/omarchy-ring-node shim, so all four call sites use the resolved runtime rather than a hardcoded /usr/bin/node.
  • Record managedNode in the install marker, remove the shim on uninstall, and drop a private runtime once a system one supersedes it (otherwise it lingers as a ~200 MB orphan).

OMARCHY_RING_NODE_BINARY / OMARCHY_RING_NPM_CLI keep overriding the choice, and now fail loudly when they point at an unsupported runtime rather than failing later.

The result is that setup no longer touches system Node.js at all, so a user's own version manager is left alone.

Verified

Beyond the test suite, I ran the download path for real: 29.6 MB, checksum matched, extracts to a working Node v22.23.2 with bundled npm 10.9.8, no temp files left behind. The full install then completed on Arch with the system nodejs 26 and a mise-managed Node both left untouched, and the backend came up on the private runtime.

I also confirmed ring-mqtt only ever spawns go2rtc, never node, so the shim is sufficient.

Tests

44 → 45. The new one stubs curl to fail, proving a pre-staged private runtime is reused rather than re-downloaded. I checked the existing 44 pass on main first, so the diff is the only thing moving them.

One note on size: the private runtime is ~199 MB, of which include/ is 63 MB of C++ headers that npm ci --ignore-scripts never needs. Pruning it is a one-liner, but I left that call to you rather than slipping it in.

Note: this touches scripts/setup-native.sh and the same tests as my other two PRs. I'll rebase whichever lands second.

🤖 Generated with Claude Code

Setup installed `nodejs-lts-jod` through `pacman -S --noconfirm`. On any
machine that already has the `nodejs` package, that is an unresolvable
conflict: the two packages conflict, and `--noconfirm` cannot answer the
replacement prompt. Setup aborts with

    :: nodejs-lts-jod-22.23.2-1 and nodejs-26.8.1-2 are in conflict

`nodejs` is a dependency of common packages, so this is reachable without
the user having chosen a Node.js version at all. It also recurs whenever
Arch's `nodejs` moves past the supported range, and asking a user to swap
their system Node.js to install a camera plugin is a large ask.

Resolve the runtime instead of dictating it:

- Drop `nodejs-lts-jod` and `npm` from the pacman package list.
- Reuse the system runtime whenever it is Node.js 20, 22, or 24.
- Otherwise install the pinned Node.js 22.23.2 LTS build privately under
  `~/.local/share/omarchy-ring/node/`, verified against its published
  SHA-256 checksum over HTTPS. This mirrors how go2rtc is already
  installed, and the tarball bundles npm, so no `npm` package is needed.
- Point the units and the panel at a `~/.local/bin/omarchy-ring-node`
  shim so the resolved runtime is used consistently.
- Record `managedNode` in the install marker, remove the shim on
  uninstall, and drop a private runtime once a system one supersedes it.

`OMARCHY_RING_NODE_BINARY` / `OMARCHY_RING_NPM_CLI` keep overriding the
choice, and now fail loudly when they point at an unsupported runtime.

Setup no longer touches system Node.js, so a user's own version manager
is left alone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant