A Braid-built Node project won't start on a Mac: its lockfile lacks the Mac binaries #273
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
The lockfiles of
pinball-braid-2andpinball-braid-solo, written in Braid's Linux container, list only the Linux build of Vite's bundler. On a Mac,npm installthennpm run devfails withCannot find module '@rolldown/binding-darwin-…'until that package is added by hand.Fix
package-lock.json, make it hold every platform's optional native packages (or regenerate it with nonode_modules), so it installs anywhere.Done when
A Node project Braid built starts with
npm install && npm run devon macOS and Linux.From the #260 hands-on play.
Braid's own console has it too. In a fresh worktree on a Mac,
npm ciinui/installs no Mac build ofrolldown, andviteststops withCannot find native binding.npm install --no-save @rolldown/binding-darwin-arm64@<version>works around it. The fix should coverui/package-lock.jsonas well as the lockfiles runs write.Shipped in #301 (
5355515, deployed). It's part ofplanned-projects-finish-right.The cause was not the lockfile. pinball-braid-2's and pinball-braid-solo's lockfiles list every platform's rolldown binding, with integrity hashes. The Mac's default Node, nvm's 20.18.0, is below Vite 8's
^20.19.0 || >=22.12.0, and npm skips an optional native package whose engine doesn't match, without saying so. Installed with Node 22, the same lockfile brings the Mac binding.Fix: a new Node project gets
.nvmrc(the Node Braid built it with) and an.npmrcwithengine-strict=true, written beside the.gitignore. Runs install withnpm_config_engine_strict=false, so a run never fails on a dependency's range. Braid's ownui/has.nvmrc(22) and the same.npmrc.Seen with run 139's game (cmoriarty/breakout-planned), cloned to this Mac:
.gitignorestep printed "and .nvmrc and .npmrc for Node". The repository has.nvmrc26and.npmrcengine-strict=true.npm installnow stops:Unsupported engine … Required: {"node":">=22.12.0"} Actual: {"node":"v20.18.0"}. The old failure was a missing binding atnpm run dev.npm install, thennpm run dev. Vite is ready in 486 ms and serves the game: title "Breakout", its canvas, and/src/main.jsanswers 200.nvm alias default 22would make Node 22 this Mac's default.