expo install command installs npm packages with versions that are compatible with your Expo SDK version. It ensures that all installed packages work together correctly.
Usage
expo add:
Arguments
One or more package names to install. Separate multiple packages with spaces.
Options
Check which installed packages need to be updated. Shows packages with incompatible versions.
Automatically update any invalid package versions to compatible versions.
Save the dependencies as devDependencies instead of dependencies.
Use npm to install dependencies. Default when
package-lock.json exists.Use Yarn to install dependencies. Default when
yarn.lock exists.Use pnpm to install dependencies. Default when
pnpm-lock.yaml exists.Use bun to install dependencies. Default when
bun.lock or bun.lockb exists.Output dependency information in JSON format. Use with
--check flag.Why Use expo install?
Version Compatibility
Expo SDK versions require specific versions of certain packages. Usingexpo install ensures you get compatible versions automatically.
For example, if you’re on Expo SDK 51:
react-nativemust be version0.74.xreactmust be version18.2.0react-dommust be version18.2.0
expo install react-native installs the correct version for your SDK.
How It Differs from npm/yarn/pnpm
| Feature | npm/yarn/pnpm | expo install |
|---|---|---|
| Version resolution | Latest or specified | SDK-compatible |
| Compatibility check | ✗ | ✓ |
| Expo packages | Manual version lookup | Automatic |
| Native modules | May be incompatible | Guaranteed compatible |
Examples
Install Single Package
Install a package with compatible version:Install Multiple Packages
Install several packages at once:Install as Dev Dependencies
Install packages as devDependencies:Check for Updates
Check which packages need updating:Fix Incompatible Versions
Automatically update incompatible packages:JSON Output
Get machine-readable output:Specify Package Manager
Use a specific package manager:Pass Additional Arguments
Pass arguments to the underlying package manager:Common Use Cases
After Upgrading Expo SDK
After upgrading to a new SDK version, fix all dependencies:Adding New Features
When adding packages with native code:Setting Up New Project
Install common dependencies:Development Dependencies
Add TypeScript and types:Package Manager Detection
Expo CLI automatically detects your package manager based on lock files:| Lock File | Package Manager |
|---|---|
package-lock.json | npm |
yarn.lock | yarn |
pnpm-lock.yaml | pnpm |
bun.lockb or bun.lock | bun |
Version Resolution
How Versions Are Determined
- Check SDK Version - Reads
expopackage version - Query API - Fetches compatible versions from Expo API
- Resolve Version - Determines the correct version for each package
- Install - Runs package manager with resolved versions
Expo Packages
For packages in theexpo-* namespace:
- Version matches your Expo SDK (e.g., SDK 51 → expo-camera 15.0.x)
- Always compatible with your SDK
Third-Party Packages
For packages likereact-native-*:
- Versions are tested and verified by Expo
- May differ from the latest npm version
- Guaranteed to work with your SDK
Latest Versions
For packages without SDK requirements:- Installs the latest version from npm
- Same behavior as
npm install
Checking Compatibility
Before Installation
Check if a package is compatible:After Installation
Verify all packages are compatible:In CI/CD
Add a check step to your pipeline:Troubleshooting
Peer Dependency Warnings
Expo install resolves peer dependencies automatically. If you see warnings:Version Conflicts
If manual version is specified in package.json:expo install --fix will update to the compatible version.
Package Not Found
If a package isn’t in the Expo compatibility list:- It will install the latest version from npm
- May require manual version management
- Check package documentation for React Native compatibility
Network Issues
If the API request fails:- Falls back to latest versions
- Use
--npmwith specific version:npm install package@version - Check internet connection
Best Practices
Always Use expo install for Expo Packages
Use for React Native Core Packages
Check Before Upgrading SDK
In Version Control
Commit lock files to ensure consistency:package-lock.json(npm)yarn.lock(yarn)pnpm-lock.yaml(pnpm)bun.lockb(bun)
CI/CD Integration
GitHub Actions Example
Pre-commit Hook
Add to.husky/pre-commit:
Additional Resources
- Compatible versions are maintained in the Expo SDK reference
- Version API endpoint:
https://exp.host/--/api/v2/versions - Report compatibility issues on GitHub