- How you use it
- cli_tool
- What it can do
- installs software · network
- What's inside
The option
| Option | Acli_tool · v1.21.5Expo Doctor CLI |
|---|---|
| How you use it | cli_tool |
| What it can do | installs software · network |
| What's inside |
What this thread does
The problem
You ask an agent to add a camera, notifications or maps package to an Expo app. It runs npm install some-package and picks the newest release. The newest release may target a newer React Native or Expo SDK than yours, so the app crashes at startup, a native module is "not found", or the build fails.
What Expo's docs say
From the Expo CLI page (docs.expo.dev), as checked on 2026-11-24:
npx expo install <pkg>is a drop-in fornpm install. It uses a list of popular packages and known working version combinations to pick versions compatible with your project'sreact-nativeversion. You can pass several packages and flags for the package manager (--npm,--pnpm,--yarn,--bun; otherwise inferred from the lockfile).npx expo install --checkreports installed packages whose versions are wrong and offers to fix them. In CI it exits non-zero, so it works as a gate.npx expo install --fixupdates invalid versions automatically. To keep a package you chose on purpose, list it underexpo.install.excludeinpackage.json.npx expo-doctoris a separate Expo tool that checks your config and dependencies for common problems; the CLI page above does not document it, so check its own help for the list of checks.
Rules snippet for CLAUDE.md or AGENTS.md
In this Expo project install packages withnpx expo install <pkg>, nevernpm install. After changing dependencies runnpx expo install --checkandnpx expo-doctorand fix what they report. Do not bump react-native or expo by hand.
Recovery steps
1. Run npx expo install --check; accept the suggested versions or run --fix. 2. Run npx expo-doctor. 3. If a package has native code and you use a development build, rebuild the native app; Expo Go only includes the bundled modules. 4. Clear the Metro cache when the error persists (npx expo start --clear).
Mistakes to check
- Hand-editing version numbers in
package.json. - Mixing lockfiles from two package managers.
- Forgetting that a new native package needs a new dev build.
Limits
Docs-based. The CLI page does not document start --clear; the official cache-clearing guide documents npx expo start --clear (checked 2026-11-24).
Sources
Primary source, checked on 2026-11-24: the Expo CLI reference docs.expo.dev/more/expo-cli.
- Confirms:
npx expo installas a best-effort replacement fornpm installthat picks versions compatible with yourreact-nativeversion from a list of known working combinations; the--npm,--pnpm,--yarnand--bunflags with lockfile detection;--checkreporting wrong versions and exiting non-zero in CI;--fixupdating invalid versions; andexpo.install.excludeinpackage.json. - Correction: this page does not mention
npx expo-doctor, so its default checks (React Native Directory validation, app-config sync) are not confirmed here. Runnpx expo-doctor --helpfor what your version checks. - Not documented on the CLI page:
expo start --clear(the page shows--clearonly for export commands); the official cache-clearing guide linked above documents it.
Started from a post by @Expo docs, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.