Repository navigation
fix(build): fail loudly on a broken install, and clean-install on Vercel - #108
Merged
Merged
Conversation
When `@astrojs/check` fails to import, `astro check` logs an error and then falls through to process.exit(0) (astro/dist/cli/index.js). In CI it doesn't even prompt: ci-info short-circuits the install offer. So a broken install -- e.g. a missing transitive like @emnapi/core -- turns the type-check gate into a silent no-op on CI and Vercel. `astro:check` is now `astro sync && astro-check`: the bin from @astrojs/check imports it statically, so the same breakage crashes with ERR_MODULE_NOT_FOUND naming the real missing package, and exits 1. The `astro sync` keeps parity with `astro check`, which syncs first; without it a fresh checkout reports 4 false errors. build, check and check:fix call `pnpm run astro:check` so the command is defined once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011rvCtaiKiC4ZSvX9yewguJ
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Vercel restores node_modules from its build cache and ran a plain incremental `pnpm install`. pnpm records skipped optional packages in node_modules/.modules.yaml and keeps skipping them on later installs, even once a new lockfile makes them required. @emnapi/[email protected] was optional (wasm32 bindings only) before Astro 7.4 and is a hard dependency of @astrojs/astro2tsx after it, so cached deploys came up without it and @astrojs/check could not load. `astro check` hid that by exiting 0; with the previous commit's astro-check the deploy fails instead, which is how this surfaced. Reproduced locally by installing the pre-7.4 lockfile, then incrementally installing this one: --frozen-lockfile alone doesn't repair it, `rm -rf node_modules` first does. (--force also works but installs every platform's optional binaries.) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011rvCtaiKiC4ZSvX9yewguJ
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 What's This PR About?
Type of Change:
📋 Description
Two commits. The first makes a broken install fail the build instead of silently skipping the type check. The second fixes the broken install on Vercel that the first commit exposed straight away.
For Technical Changes:
astro:checkis nowastro sync && astro-check, replacingastro check.build,checkandcheck:fixcallpnpm run astro:check, so the command is defined once.installCommandis nowrm -rf node_modules && pnpm install --frozen-lockfile, replacingpnpm install.package.jsonscripts,vercel.json, and wording in CLAUDE.md, README.md, theci.ymlcomment and the session-start hook comment. No change to what gets built.f4360f7:astro-checkinstead ofastro checkIf
@astrojs/checkfails to import,astro checklogs[ERROR]and then exits 0: a non-boolean return falls through toprocess.exit(0)inastro/dist/cli/index.js. Under CI (GitHub Actions and Vercel both count),ci-infoskips the install prompt entirely. So a broken install turns the type-check gate into a silent no-op.astro-checkis the bin that ships with@astrojs/check. It imports the package statically, so the same breakage crashes withERR_MODULE_NOT_FOUND, names the actual missing package, and exits 1.The
astro synckeeps parity, sinceastro checksyncs before checking. Without it, a fresh checkout with no.astro/reports 4 false errors.Second commit: clean-install
node_moduleson VercelThe first push failed on Vercel within seconds, and that failure was real. Vercel restores
node_modulesfrom its build cache and ran a plain incrementalpnpm install.pnpm records the optional packages it skipped in
node_modules/.modules.yaml, and keeps skipping them on later installs even after a lockfile change makes them required:@emnapi/[email protected]was optional (wasm32 bindings only), so linux skipped it@astrojs/astro2tsxSo cached Vercel deploys came up without it, and
@astrojs/checkcouldn't load. With the oldastro checkthat went unnoticed, which means #107's Vercel builds most likely deployed without type-checking. GitHub CI, which always installs clean, did type-check #107 and reported 0 errors, so nothing bad shipped.I reproduced it locally by installing the pre-7.4 lockfile, then installing this one on top:
@emnapi/runtime@astrojs/checkimportspnpm install(old Vercel command)pnpm install --frozen-lockfilepnpm install --force@oxc-parserbindings)rm -rf node_modules && pnpm install --frozen-lockfile🖼️ Visual Changes
🧪 Testing
pnpm run devpnpm run buildAll runs used
CI=trueto match GitHub Actions and Vercel:astro check)astro sync && astro-check)@emnapi/coreremoved fromnode_modules[ERROR], exit 0ERR_MODULE_NOT_FOUND: @emnapi/core, exit 1;buildalso exits 1Result (36 files), 0 errorsResult (36 files), 0 errors, exit 0ts(2322),Result (37 files): 1 error, exit 1.astro/directoryastro-checkwithout sync: 4 false errors)pnpm run buildandpnpm run checkpass: 215 pages, lint and format clean. That holds both from a clean install and from the stale tree after running the new Vercel install command.📚 Documentation
README.md updated (explain what changed)
README: the command table, CI section and mermaid diagram describe the new script.
CLAUDE.md: records why it isn't plain
astro check, why theastro syncmatters, and why Vercel deletesnode_modulesbefore installing.🔗 Related
astro checkexits 0 when@astrojs/checkis missing (Astro CLI)node-linker=hoisted✅ Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_011rvCtaiKiC4ZSvX9yewguJ