I’m trying to migrate from react-navigation to expo-router. My project is in a mono repo that is configured with lerna
and I getting this
error: node_modules/expo-router/_ctx.web.js: node_modules/expo-router/_ctx.web.js:Invalid call at line 2: process.env.EXPO_ROUTER_APP_ROOT
First argument of require.context` should be a string denoting the directory to require.`
so I followed this Expo Troubleshooting guide the only change is my app entry point is in index.js
and my app is in the src/app
directory so I changed this part in my index.js
export function App() {
const ctx = require.context('.src/app'); <---- change ./app to ./src/app
return <ExpoRoot context={ctx} />;
}
even though it’s giving me an error. since my entry is in index.js in package.json
main points to the "main": "index.js",
I have imported this manually into index.js to check whether that was the issue, but I’m still getting this error.
import 'expo-router/entry';
When I did some digging, I encountered this issue, but that didn’t help me either. I was just stuck on this issue for days.
I started out using expo:50.0.17,
but after reading some of the solutions posted on Github, I downgraded the expo version to 50.0.15
, which didn’t function as well.