create-t3-turbo: bug(android): `main: expo-router/entry` is not resolved
Provide environment information
System: OS: macOS 14.0 CPU: (8) arm64 Apple M1 Memory: 96.88 MB / 8.00 GB Shell: 3.6.1 - /opt/homebrew/bin/fish Binaries: Node: 21.1.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.2.0 - /opt/homebrew/bin/npm
Describe the bug
When attempting to run the Expo app in the Android emulator environment, specifically on the Pixel_7_API_UpsideDownCakePrivacySandbox, the module resolution fails with an error for expo-router/entry. This issue does not occur when running the Next.js project, which proceeds without any hitches.
Error: Unable to resolve module ./node_modules/expo-router/entry from <PROJECT_ROOT>/apps/expo/.:
None of these files exist:
* node_modules/expo-router/entry(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs|.android.scss|.native.scss|.scss|.android.sass|.native.sass|.sass|.android.css|.native.css|.css|.android.css|.native.css|.css)
* node_modules/expo-router/entry/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs|.android.scss|.native.scss|.scss|.android.sass|.native.sass|.sass|.android.css|.native.css|.css|.android.css|.native.css|.css)
at ModuleResolver.resolveDependency (<PROJECT_ROOT>/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15)
at DependencyGraph.resolveDependency (<PROJECT_ROOT>/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
at <PROJECT_ROOT>/node_modules/metro/src/lib/transformHelpers.js:169:21
at Server._resolveRelativePath (<PROJECT_ROOT>/node_modules/metro/src/Server.js:1045:12)
at async Server.requestProcessor [as _processBundleRequest] (<PROJECT_ROOT>/node_modules/metro/src/Server.js:449:37)
at async Server._processRequest (<PROJECT_ROOT>/node_modules/metro/src/Server.js:383:7)
Link to reproduction
To reproduce
Initialise the project using create-t3-turbo. Install dependencies with pnpm i. Push database changes with pnpm db:push. Start the development server using pnpm dev. After following these steps, the Next.js project runs correctly, while the Expo app does not, resulting in a resolution error for the expo-router/entry module when trying to launch from index.tsx.
Expected Behaviour: The Expo app should resolve all modules correctly and launch without errors, similar to the Next.js project’s behavior.
Actual Behavior: The Expo app fails to resolve the expo-router/entry module and throws an error, preventing the app from running on the Android emulator.
Additional information
This works fine with the iOS simulator
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 5
- Comments: 15 (4 by maintainers)
Works as expected. Thank you. For those who are still not sure how to do it:
"main": "expo-router/entry",to:"main": "index.js",index.jsfile next to thepackage.jsonfile. In my case I createdapps/expo/index.jsfile .index.jsfile I added just 1 line:This should work as it did in my case.
You can create index.js and import expo router entry there, then point package.json:main to that
It does work with this method tho: https://github.com/t3-oss/create-t3-turbo/issues/741#issuecomment-1812454342 But not when “main” in package.json is set to “expo-router/entry”
Resolved in sdk 50 which we just updated to in #795