Skip to content

fix(deploy,web): drop stale npm lockfile, pin Bun, add Vercel Analytics#25

Merged
Railly merged 1 commit into
mainfrom
fix/vercel-deploy
Apr 29, 2026
Merged

fix(deploy,web): drop stale npm lockfile, pin Bun, add Vercel Analytics#25
Railly merged 1 commit into
mainfrom
fix/vercel-deploy

Conversation

@Railly
Copy link
Copy Markdown
Contributor

@Railly Railly commented Apr 29, 2026

Problem

Vercel deploy of `sunat-cli-website` was failing on `main` after PR #24 with the classic npm + Rollup optional-deps bug:

```
Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related
to optional dependencies (npm/cli#4828).
```

Root cause: a stale `package-lock.json` from before the Bun migration was sitting in the repo root. Vercel's auto-detection saw it and ran `npm install` instead of `bun install`, then triggered the Rollup bug.

Fix

  • Delete `package-lock.json` from the repo root. Bun is the canonical package manager; `bun.lock` is the only lockfile that should exist.
  • Add `packageManager: bun@1.3.11` to root `package.json` so Vercel/Corepack pick Bun unambiguously.
  • Add `@vercel/analytics` 2.0.1 to the website (per the user's request to enable Web Analytics) and `inject()` it from a client script in both `index.astro` and `legal.astro`. Confirmed in the built output: bundled and pinging `/_vercel/insights`.

Test plan

  • `rm -rf node_modules packages/website/node_modules && bun install` → 325 packages, no errors
  • `bun run build` in `packages/website` → 2 pages built in 1.13s
  • grep over `dist/_astro/index.*.js` confirms analytics SDK is bundled and the endpoint is `/_vercel/insights`
  • Vercel deploy on this branch (preview) is green

Vercel was running 'npm install' (because root package-lock.json existed
from before the Bun migration), then 'npm run build', and hitting the
known npm bug with Rollup optional deps:
  Cannot find module @rollup/rollup-linux-x64-gnu

Fixes:
- Delete root package-lock.json (Bun is the canonical PM, bun.lock is
  the only lockfile in tree).
- Add packageManager: bun@1.3.11 to root package.json so Vercel and
  Corepack pick the right tool unambiguously.
- Add @vercel/analytics 2.0.1 to the website and inject() it from a
  client script in index.astro and legal.astro. Confirmed in built
  output: bundled and pinging /_vercel/insights.

Build verified: bun install -> 325 packages, astro build -> 2 pages in
1.13s, no warnings beyond an unrelated Astro upstream Vite import note.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sunat-cli-website Ready Ready Preview, Comment Apr 29, 2026 6:49am

@Railly Railly merged commit 9e4905c into main Apr 29, 2026
4 checks passed
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