Skip to content

fix: run frontend npm steps with cwd instead of --prefix in scaffolded build.zig#94

Open
mvanhorn wants to merge 1 commit into
vercel-labs:mainfrom
mvanhorn:fix/56-no-binary-found-darwin-x64
Open

fix: run frontend npm steps with cwd instead of --prefix in scaffolded build.zig#94
mvanhorn wants to merge 1 commit into
vercel-labs:mainfrom
mvanhorn:fix/56-no-binary-found-darwin-x64

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

In src/tooling/templates.zig, change the generated build.zig's frontend steps (npm install --prefix frontend at ~line 935 and npm --prefix frontend run build at ~line 939) to plain npm install / npm run build with frontend_install.setCwd(b.path("frontend")) / frontend_build.setCwd(b.path("frontend")), and update the templated README snippet (~line 2746) plus the dev-command template (~line 2007) to cd frontend-style or cwd-based invocations consistent with how the runner executes them. Mirror the same change in the four checked-in example apps (examples/next, react, svelte, vue build.zig), which are copies of the template output. Update the inline std.testing assertions in templates.zig (~line 2872) that currently pin the exact "npm", "install", "--prefix", "frontend" argv.

Why this matters

A macOS user hit "No binary found for darwin-x64" from the old zero-native postinstall-download dispatcher, and its suggested remedy (npm run build:native) failed outside the repo. A Windows user reproduced the follow-on failure: the scaffolded app's zig build run executes npm install --prefix frontend, and npm 10.9.3 dies with ENOENT trying to read the app root's nonexistent package.json; upgrading to npm 11 made it work. The original darwin-x64 half is already obsolete: the package is now @native-sdk/cli with per-platform optionalDependencies (@native-sdk/cli-darwin-x64 exists under packages/native-sdk/npm/) and bin/native.js no longer suggests build:native. The remaining reproducible bug in current code is the npm --prefix invocation baked into the scaffold and examples, which breaks on npm < 11 (notably on Windows).

See #56.

Testing

  • Happy path: zig build test (or the templates.zig inline tests) passes with the updated argv assertions; generated build.zig contains cwd-scoped npm steps and no --prefix. - Edge case: scaffold an app with native init --frontend next and confirm zig build run installs frontend deps with npm 10.x semantics (no read of app-root package.json). - Edge case: examples/*/build.zig stay in sync with the template (check-framework-sync/CI template checks still pass). - Error path: npm missing from PATH still surfaces the run-step failure for the frontend-install step with a clear failed-command message.

Fixes #56

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@mvanhorn is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

No binary found for darwin-x64

1 participant