Bun: error: Cannot find package '...' imported from ...
error: Cannot find package "lucide-react" imported from "/app/src/components/button.tsx". Run `bun install` to install dependencies.
Immediate Remediation
bash
bun install --frozen-lockfile || (rm -f bun.lockb && rm -rf node_modules && bun install)
Root Cause Analysis
Bun's lockfile (bun.lockb) or node_modules is out of sync with package.json, so a package listed in the source isn't resolved by the runtime. The error occurs when the package isn't present in the dependency tree or the lockfile is corrupted/incomplete.
Verification & Guardrails
- Use --frozen-lockfile in CI to ensure reproducible installs; if it fails, you have a lockfile mismatch.
- Deleting bun.lockb and node_modules forces a fresh resolve but may upgrade transitive dependencies; commit the new lockfile after.
- Always run `bun install` after editing package.json to keep the lockfile current.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.