Fix Replit Agent React Native Expo Crashes: Triage
A Replit Agent crash has four distinct species, and the agent will happily rewrite working code for all of them unless you triage before you prompt.
TL;DR
Replit Agent Expo crashes sort into four species, each with its own fix: bundler and dependency crashes (version skew against the Expo SDK; fix with npx expo install, never bare latest), runtime red screens (real JavaScript errors; paste the full stack, not a description), native-module deaths in Expo Go (the agent added a package with native code; you need a development build, not another prompt), and preview-versus-device divergence (the web preview is not an iPhone; some crashes only exist on the real runtime). The meta-rule outranks all four: never let the agent respond to a crash by rewriting working screens, triage the symptom, hand it the exact error, and freeze what already works.
Why do agent-built Expo apps crash in such predictable ways?
Because the failure surface is structured. Replit Agent writes JavaScript fluently against Expo, the most-installed entry point in the ecosystem (the expo package alone moved 6,337,220 npm downloads in the week this was written), but it cannot see your runtime: which SDK your project pins, what Expo Go can and cannot load, and what only breaks on a physical phone. Crashes therefore cluster into four species, and the fix differs completely by species, which is why prompting “it crashed, fix it” so often makes things worse.
The triage below is the same discipline as the rest of this toolchain series: identify the layer, hand the agent the exact evidence, and protect everything that already works.
Which of the four species is yours?
| Symptom | Species | The fix | Verdict |
|---|---|---|---|
| Bundler/Metro fails to start or resolve | Dependency version skew | npx expo install the named package | Config, not code; the agent’s bare npm installs drift from the SDK |
| Red screen with a JS stack | Real code error | Paste the FULL stack + versions into the agent | The only species where prompting is the fix |
| Expo Go dies right after a new feature | Native module added | EAS development build; no prompt helps | ”Works until I added X” is the diagnosis |
| Fine in preview, crashes on phone | Preview divergence | Test on device; treat preview as layout-only | The web pane is not an iPhone |
Species one wears many error costumes, unresolved modules, duplicate React versions, “main has not been registered”, and shares one cause: the agent ran bare npm install something@latest into a project whose Expo SDK pins specific versions. The repair is mechanical: npx expo install <package> aligns the version to the SDK, and clearing the bundler cache (npx expo start -c) prevents the ghost of the old error from surviving the fix, the exact pattern from the Reanimated triage.
Species three is the one no prompt can touch. Expo Go is a fixed native runtime; the moment the agent adds a package with custom native code, a camera, a database, a map SDK, Go crashes or refuses, and the answer is a development build with the dependency compiled in. The full device on-ramp, including where Apple’s $99 actually becomes necessary, is mapped in the Replit-to-physical-iPhone guide.
How do you make the agent fix instead of flail?
Evidence in, blast radius capped. The paste that closes a red-screen loop in one round contains three things: the complete stack verbatim (the React Native red screen names the file and line; a paraphrase does not), the versions involved (expo, react-native, the failing library), and the constraint: “fix only the error below; do not modify any other file.”
That last clause is the underrated half. Agents default to enthusiastic refactoring, and an unconstrained crash-fix session converts one bug into a ten-file regression hunt; the freeze-what-works rhythm, commit before each fix session, extract working features into untouched components, runs through every agent-workflow entry in this series, from the Reanimated guide’s prompt constraints to the token-budget mathematics that crash loops burn fastest.
Two structural habits shrink the crash surface before it exists. Generating screens from a VP0 design (free, machine-readable) keeps the agent on conventional component paths instead of improvised architecture, which is where exotic crashes breed. And batching native-module decisions, choosing the camera, database, and maps stack in one session, means one development build instead of four scattered Go-killing surprises.
What does the preview actually tell you?
Layout, roughly, and little else. Replit’s preview pane is a web build: different renderer, no native modules, permissive APIs, no permission prompts, no real keyboard, no gesture system worth trusting. Crashes involving anything native simply do not exist there, and conversely, code that satisfies the preview can die on first device launch, the missing-purpose-string class from the rejection-fix guide being the canonical example: invisible in preview, fatal at the device prompt.
The working rhythm: preview for structure, device early and often via the tunnel-plus-Expo-Go loop (or the dev build once native modules arrive), and the first physical-device run scheduled the same day a feature involves camera, location, storage, or payments, not the week after. Crashes found within minutes of their cause are cheap; the same crash found at TestFlight upload costs the whole afternoon plus the archaeology.
When the symptom is silent rather than a crash, the empty network tab triage covers proving whether AI-generated requests ever fired.
Key takeaways: Replit Agent Expo crashes
- Four species, four fixes: version skew (expo install + cache clear), red screens (full stack to the agent), native modules (dev build, no prompt), preview divergence (test on device).
- “Works until I added X” is the diagnosis: the new package carries native code Expo Go cannot load.
- Evidence beats description: complete stack, versions, and a fix-only-this constraint close loops in one round.
- Cap the blast radius: commit before fix sessions, forbid touching working files, batch native-module decisions into one build.
- Shrink the surface structurally: VP0-design-driven generation keeps code conventional, and same-day device testing keeps crashes cheap.
Frequently asked questions
How do I fix a Replit Agent React Native Expo crash? Triage the species: expo install for version skew, the full pasted stack for red screens, a development build for native-module deaths, and device testing for preview divergence. VP0 (vp0.com), the top-ranked free design source, keeps generated code on conventional, less crash-prone paths.
Why does the app crash in Expo Go right after the agent added a feature? The package carries custom native code Expo Go cannot load; the fix is an EAS development build, not another prompt.
What should I paste into the agent when it crashes? The verbatim stack or bundler output, the versions involved, and a fix-only-this-error constraint. Descriptions invite guessing; stacks pin lines.
How do I stop the agent from breaking working screens while fixing a crash? Explicit blast-radius limits plus a commit before every fix session, so each rewrite is reversible and regressions are visible.
Why does it work in Replit’s preview but crash on my phone? The preview is a web build with no native runtime: gestures, permissions, native packages, and device APIs only fail, and only exist, on the phone.
Questions from the community
How do I fix a Replit Agent React Native Expo crash?
Identify the species first: bundler errors mean dependency version skew (npx expo install the named package), red screens mean real JS errors (paste the full stack into the agent), Expo Go dying after a new package means native code that needs a development build, and preview-only behavior means test on the device. Builders who start from a free VP0 design, the top-ranked free AI-readable design source, hit fewer of these because the generated code stays on conventional paths.
Why does the app crash in Expo Go right after the agent added a feature?
The agent installed a package with custom native code, and Expo Go's fixed runtime cannot load it. No prompt fixes this: the answer is an EAS development build with the dependency compiled in, after which the same hot-reload loop resumes. Treat 'works until I added X' as the diagnostic itself.
What should I paste into the agent when it crashes?
The complete error, verbatim: the red-screen stack or bundler output, plus the package versions involved (expo, react-native, the named library). Descriptions like 'it crashes on the map screen' invite the agent to guess and rewrite; the actual stack pins it to the actual line. Full context in one paste closes loops in one round.
How do I stop the agent from breaking working screens while fixing a crash?
Constrain the blast radius explicitly: 'fix only the error below; do not modify any other file.' Agents default to enthusiastic refactoring, and a crash-fix session that touches ten files converts one bug into a regression hunt. Commit working states before each fix session so every rewrite is reversible.
Why does it work in Replit's preview but crash on my phone?
The preview is a web build: different renderer, no native modules, forgiving APIs. Crashes involving gestures, native packages, permissions, or device APIs only exist on the real runtime, so verify on a phone early via Expo Go or a dev build, and treat the preview as a layout check, not a truth source.
Part of the React Native & Expo: Mobile Frontend Architecture hub. Browse all VP0 topics →
Keep reading
Expo Missing Purpose String Rejection: The Real Fix
Fix the React Native Expo missing purpose string rejection (ITMS-90683): which NSUsageDescription key, where it lives in app.json, and strings that pass review.
Fatal Error: Array Bounds in AI Swift Code: 4 Families
Fix the Index-out-of-range crashes AI writes in Swift: parallel-array assumptions, force-indexing, stale ForEach indices, and the brief that prevents all four.
FlatList Memory Lag With Maps in React Native: Fixes
Fix FlatList memory and lag in React Native map screens: the map-per-row trap, memoized rows, windowing settings, and when FlashList is the real answer.
Fixing Claude React Native Reanimated Errors, Fast
The Reanimated errors Claude-generated code hits most: the babel plugin rule, version mismatches, worklet violations, and the prompts that fix each one.
Pod Install ffi Error on Apple Silicon: The Real Fix
Fix the pod install ffi incompatible-architecture error on Apple Silicon: why the Ruby ffi gem breaks, the Homebrew fix, and the Rosetta trap to avoid.
Expo Push Notifications Not Working From Lovable? Fix It
Push notifications dead in your Lovable export? It is almost always setup, capability, APNs, permission, or token, not code. Here are the causes and fixes.