Search code examples
iosreact-nativemobileexpometro-bundler

iOS Bundling failed: Error running an expo development build


So I recently updated my expo SDK from 49 to 51 and created a new development build, but when I tried to run metro I had the error below;

iOS Bundling failed 1653ms error: node_modules\expo-router_ctx.ios.tsx: node_modules\expo-router_ctx.ios.tsx: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.

I have seen a bunch of solutions online about not including expo-router/babel in the babel.config then creating a new development build and other solutions that did not work for me.


Solution

  • What fixed this error for me was running the command npm i --save-dev @types/node which installed type dependencies for Node JS as a development dependency. The running metro again.