1--- 2title: Troubleshooting 3description: Fixing common issues with Expo Router setup. 4--- 5 6import { Terminal } from '~/ui/components/Snippet'; 7 8## `EXPO_ROUTER_APP_ROOT` not defined 9 10If `process.env.EXPO_ROUTER_APP_ROOT` is not defined you'll see the following error: 11 12<Terminal 13 cmd={[ 14 '$ Invalid call at line 11: process.env.EXPO_ROUTER_APP_ROOT First argument of require.context should be a string.', 15 ]} 16/> 17 18This can happen when: 19 20- The project is using an `expo` version lower than `expo@^46.0.13`. Version `46.0.13` enables context modules and injects `process.env.EXPO_ROUTER_APP_ROOT` into the process. 21- The babel plugin `expo-router/babel` is not being used in the project **babel.config.js**. You can try clearing the cache with: 22 23<Terminal cmd={['$ npx expo start --clear']} /> 24 25Alternatively, you can circumvent this issue by creating an **index.js** file in the root of your project with the following contents: 26 27```jsx index.js 28import { registerRootComponent } from 'expo'; 29import { ExpoRoot } from 'expo-router'; 30 31// Must be exported or Fast Refresh won't update the context 32export function App() { 33 const ctx = require.context('./app'); 34 return <ExpoRoot context={ctx} />; 35} 36 37registerRootComponent(App); 38``` 39 40> Do not use this to change the root directory (**app**) as it won't account for usage in any other places. 41 42## `require.context` not enabled 43 44This can happen if you are using an `expo` version lower than `expo@^46.0.13`. Version `46.0.13` enables context modules and injects `process.env.EXPO_ROUTER_APP_ROOT` into the process. 45 46This can also be the result of using a custom version of `@expo/metro-config` that does not enable context modules. Expo Router requires the project **metro.config.js** to use `expo-router/metro` as the default configuration. Delete the **metro.config.js**, or extend `expo/metro-config`. See [Customizing metro](/guides/customizing-metro/) for more information. 47