# Troubleshooting

## Troubleshooting overview

An overview of troubleshooting guides for app development with Expo and EAS.

This page lists a collection of various troubleshooting guides for Expo and EAS.
## Error and warnings
## Runtime issues in development and production
## Expo Router
## Push notifications
## EAS


## "Application has not been registered" error

Learn about what the Application has not been registered error means and how to resolve it in an Expo or React Native app.

When developing an Expo or React Native app, it's common to run into an error that looks like:
```sh
Application "main" has not been registered.
Invariant Violation: "main" has not been registered.
```
In this particular error, `"main"` can be any string.
## What this error means
### An exception may be preventing your app from registering itself
The most common cause of this error is that there is an exception thrown in your application before it's able to register itself. When a React Native application loads, there are two steps:
1. Load the JavaScript code, and if everything is successful, then your application will be registered. If there is any exception when loading the bundle then execution will be aborted and it will never reach the part where your application is registered.
2. Run the registered application. If loading the code failed, then the application won't be registered and you will see the error that is the subject of this page.
If you're in this situation, the error message you're seeing is a [red herring](https://en.wikipedia.org/wiki/Red_herring), it's distracting you from the real error that led to the application not being registered.
Look at your logs before this error message to see what may have caused it. A frequent cause is multiple versions of a native module dependency that registers itself as a view &mdash; for example [this Stack Overflow thread](https://stackoverflow.com/questions/67543844/invariant-violation-main-has-not-been-registered-while-running-react-native-a/67550379) where the poster has multiple versions of `react-native-safe-area-context` in their dependencies.
### Your app root component may not be registered
Another possibility is that there is a mismatch between the `AppKey` being provided to [`AppRegistry.registerComponent`](https://reactnative.dev/docs/appregistry#registercomponent), and the `AppKey` being registered on the native iOS or Android side.
In managed projects, the default behavior is to use "main" as the `AppKey`. This is handled for you automatically, and as long as you don't change the `"main"` field in your **package.json** from the default value then this will just work. If you want to customize the app entry point, see [registerRootComponent](/versions/latest/sdk/expo/#registerrootcomponentcomponent) API reference.
In projects with native code, you will see something like this in your **index.js** by default:
```js
import { registerRootComponent } from 'expo';
import App from './App';
registerRootComponent(App);
```
where `registerRootComponent` is implemented as:
```js
function registerRootComponent(component) {
  AppRegistry.registerComponent('main', () => component);
}
```
And on the native side, in **AppDelegate.m** you should see:
```objectivec
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
```
and in **MainActivity.java**:
```java
@Override
protected String getMainComponentName() {
  return "main";
}
```
By default, "main" is consistently used throughout the project. If you're running into this error, something has likely changed and these values no longer coincide. Ensure that the names you are registering on the JavaScript side are the ones expected on the native side (if you're using Expo's `registerRootComponent` function, that would be "main").
## Other considerations
This error can also occur in a few other scenarios, but it's less predictable and the fixes would be more specific to your project. For example, some other cases are:
- You're connecting to the wrong project's local development server. Try closing out other Expo CLI or React Native community CLI processes (find them with `ps -A | grep "expo\|react-native"`).
- If this error is only occurring in your production app, then try running the app locally in production mode with `npx expo start --no-dev --minify` to find the source of the error.


## Clear bundler caches on macOS and Linux

Learn how to clear the bundler cache when using Yarn or npm with Expo CLI or React Native CLI on macOS and Linux.

> Need to clear development caches on Windows? [Find the relevant commands here.](/troubleshooting/clear-cache-windows/)
There are a number of different caches associated with your project that can prevent your project from running as intended. Clearing a cache sometimes can help you work around issues related to stale or corrupt data and is often useful when troubleshooting and debugging.
To clear the various caches, run:
## Expo CLI and Yarn
```sh
you may need to delete node_modules in each workspace
$ rm -rf node_modules
$ yarn cache clean
$ yarn
$ watchman watch-del-all
$ rm -fr $TMPDIR/haste-map-*
$ rm -rf $TMPDIR/metro-cache
$ npx expo start --clear
```
## Expo CLI and npm
```sh
$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ watchman watch-del-all
$ rm -fr $TMPDIR/haste-map-*
$ rm -rf $TMPDIR/metro-cache
$ npx expo start --clear
```
## React Native CLI and Yarn
```sh
you may need to delete node_modules in each workspace
$ rm -rf node_modules
$ yarn cache clean
$ yarn
$ watchman watch-del-all
$ rm -fr $TMPDIR/haste-map-*
$ rm -rf $TMPDIR/metro-cache
$ yarn start -- --reset-cache
```
## React Native CLI and npm
```sh
$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ watchman watch-del-all
$ rm -fr $TMPDIR/haste-map-*
$ rm -rf $TMPDIR/metro-cache
$ npm start -- --reset-cache
```
## What these commands are doing
It is a good habit to understand commands you find on the internet before you run them. We explain each command below for Expo CLI, npm, and Yarn, but the corresponding commands React Native CLI have the same behavior.
| Command                   | Description                                                                   |
| ------------------------- | ----------------------------------------------------------------------------- |
| `rm -rf node_modules`     | Clear all of the dependencies of your project                                 |
| `yarn cache clean`        | Clear the global Yarn cache                                                   |
| `npm cache clean --force` | Clear the global npm cache                                                    |
| `yarn`/`npm install`      | Reinstall all dependencies                                                    |
| `watchman watch-del-all`  | Reset the `watchman` file watcher                                             |
| `rm -rf $TMPDIR/<cache>`  | Clear the given packager/bundler cache file or directory                      |
| `npx expo start --clear`  | Restart the development server and clear the JavaScript transformation caches |


## Clear bundler caches on Windows

Learn how to clear the bundler cache when using Yarn or npm with Expo CLI or React Native CLI on Windows.

> Need to clear development caches on macOS or Linux? [Find the relevant commands here.](/troubleshooting/clear-cache-macos-linux/)
There are a number of different caches associated with your project that can prevent your project from running as intended. Clearing a cache sometimes can help you work around issues related to stale or corrupt data and is often useful when troubleshooting and debugging.
## Expo CLI and Yarn
```sh
you may need to delete node_modules in each workspace
$ rm -rf node_modules
$ yarn cache clean
$ yarn
$ watchman watch-del-all
$ del %localappdata%\Temp\haste-map-*
$ del %localappdata%\Temp\metro-cache
$ npx expo start --clear
```
## Expo CLI and npm
```sh
$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ watchman watch-del-all
$ del %localappdata%\Temp\haste-map-*
$ del %localappdata%\Temp\metro-cache
$ npx expo start --clear
```
## React Native CLI and Yarn
```sh
you may need to delete node_modules in each workspace
$ rm -rf node_modules
$ yarn cache clean
$ yarn
$ watchman watch-del-all
$ del %localappdata%\Temp\haste-map-*
$ del %localappdata%\Temp\metro-cache
$ yarn start -- --reset-cache
```
## React Native CLI and npm
```sh
$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ watchman watch-del-all
$ del %localappdata%\Temp\haste-map-*
$ del %localappdata%\Temp\metro-cache
$ npm start -- --reset-cache
```
## What these commands are doing
It is a good habit to understand commands you find on the internet before you run them. We explain each command below for Expo CLI, npm, and Yarn, but the corresponding commands React Native CLI have the same behavior.
| Command                           | Description                                                                   |
| --------------------------------- | ----------------------------------------------------------------------------- |
| `del node_modules`                | Clear all of the dependencies of your project                                 |
| `yarn cache clean`                | Clear the global Yarn cache                                                   |
| `npm cache clean --force`         | Clear the global npm cache                                                    |
| `yarn`/`npm install`              | Reinstall all dependencies                                                    |
| `watchman watch-del-all`          | Reset the `watchman` file watcher                                             |
| `del %localappdata%\Temp/<cache>` | Clear the given packager/bundler cache file or directory                      |
| `npx expo start --clear`          | Restart the development server and clear the JavaScript transformation caches |


## "React Native version mismatch" errors

Learn about what React Native version mismatch means and how to resolve it in an Expo or React Native app.

When developing an Expo or React Native app, it's common to run into an error that looks like:
```sh
React Native version mismatch.
JavaScript version: X.XX.X
Native version: X.XX.X
Make sure you have rebuilt the native code...
```
## What this error means
The bundler that you're running in your terminal (using `npx expo start`) is using a different JavaScript version of `react-native` than the native app on your device or emulator. This can happen after upgrading your React Native or Expo SDK version, _or_ when connecting to the wrong local development server.
## How to fix it
- Close out any development servers that you have running (you can list all terminal processes with the `ps` command, and search for Expo CLI or React Native community CLI processes with `ps -A | grep "expo\|react-native"`).
- If this is a Expo project, either remove the `sdkVersion` field from your **app.json** file, or make sure it matches the value of the `expo` dependency in your **package.json** file.
- If this is a Expo project, you should make sure your `react-native` version is correct. Run `npx expo-doctor` will show a warning where the `react-native` version you should install. If you did upgrade to a newer SDK, make sure to run `npx expo install --fix` and follow the prompts. Expo CLI will make sure that your dependency versions for packages like `expo` and `react-native` are aligned.
- If this is a bare React Native project, and this error is occurring right after upgrading your React Native version, you should double-check that you have performed each of the upgrade steps correctly.
- Finally:
  - Clear your bundler caches by running `rm -rf node_modules && npm cache clean --force && npm install && watchman watch-del-all && rm -rf $TMPDIR/haste-map-* && rm -rf $TMPDIR/metro-cache && npx expo start --clear`
    - Commands if you are using npm can be found [here.](clear-cache-macos-linux)
    - Commands if you are using Windows can be found [here.](clear-cache-windows)
  - If this is a bare React Native project, run `npx pod-install`, then rebuild your native projects (run `yarn android` to rebuild for Android, and `yarn ios` to rebuild iOS)


## Troubleshooting Proxies

Learn about troubleshooting proxies with a set of recommended tools.

## macOS proxy configuration (Sierra)
> If anything goes wrong, you can revert to the "Automatic Proxy settings" in System Network Preferences using Automatic Proxy Configuration `your-corporate-proxy-uri:port-number/proxy.pac`.
### Overview
To run this in the local iOS Simulator while on your corporate Wi-Fi network, a local proxy manager is required. You can use a local proxy application such as [Charles](http://charlesproxy.com).
#### Open macOS network preferences
1. Open `System Preferences` for your Mac (Apple Menu > System Preferences).
2. Go to Network.
3. Be sure your `Location` is set to your proxy network, and not "Automatic".
4. With Wi-Fi selected on the left and/or ethernet connection, click `Advanced...` on the bottom right side of the window.
#### Configure proxy address
1. Disable/uncheck "Automatic Proxy Configuration" if it is set.
2. Check "Web Proxy (HTTP)" and set "Web Proxy Server" to 127.0.0.1 : 8888
3. Check "Secure Web Proxy (HTTPS)" and set "Secure Web Proxy Server" to 127.0.0.1 : 8888
### Configure `Charles`
1. Open Charles
2. If it asks, don't allow it to manage your macOS Network Configuration, the previous steps do that. (If you change Charles port, update the previous step to the correct port instead of default 8888)
3. In the menu of Charles go to `Proxy > External Proxy Settings`, check `Use external proxy servers`
4. Check `Web Proxy (HTTP)`, and enter `your-corporate-proxy-uri:port-number`
5. Check `Proxy server requires a password`
6. Domain: YOUR DOMAIN,
   Username: YOUR USERNAME
   Password: YOUR PASSWORD
7. Same for Secure Web Proxy (HTTPS). _Be sure to fill in the same proxy, username, and password address_ fields.
8. In the text area for `Bypass external proxies for the following hosts:` enter:
   ```text
   localhost
   *.local
   ```
   You may need to include your mail server or other corporate network addresses.
9. Check "Always bypass external proxies for localhost"
### iOS Simulator configuration
If you have an existing iOS Simulator custom setup going that is not working, "Simulator > Reset Content and Settings" from the menu.
If you have the Simulator open still, quit it.
Now, in Charles under the "Help" menu > Install Charles Root Certificate, and then again for Install Charles Root Certificate in iOS Simulators
> **Technical note:** This whole process is required because the iOS Simulator is served a bum proxy certificate instead of the actual certificate, and doesn't allow it, for https://exp.host/ which is required to run Expo.  **Also note:** Configure applications that need internet access, such as Spotify, to use http://localhost:8888 as your proxy. Some apps, such as Chrome and Firefox, you can configure in the settings to use your "System Network Preferences" which will use Charles : 8888, or no proxy, depending on how you have your "Location" set in the Apple menu/network preferences. If you are set to "Automatic" no proxy is used, if it is set to "your proxy network" the proxy is used and Charles will need to be running.
## Command line application proxy configuration
npm, git, Brew, Curl, and any other command line applications need proxy access too.
#### For npm
Open `~/.npmrc` and set:
```ini .npmrc
http_proxy=http://localhost:8888
https_proxy=http://localhost:8888
```
### For git
Open `~/.gitconfig` and set
```ini .gitconfig
[http]
  proxy = http://localhost:8888
[https]
  proxy = http://localhost:8888
```
### For command line applications
Depending on your shell, and config, Open `~/.bashrc`, `~/.bash_profile`, or `~/.zshrc` or wherever you set your shell variables and set:
```bash
export HTTP_PROXY="http://localhost:8888"
export http_proxy="http://localhost:8888"
export ALL_PROXY="http://localhost:8888"
export all_proxy="http://localhost:8888"
export HTTPS_PROXY="http://localhost:8888"
export https_proxy="http://localhost:8888"
```
> If you switch your network location back to "Automatic" to use npm or git, you will need to comment these lines out using a `#` before the line you wish to disable. You could alternatively use a command-line proxy manager if you prefer.