question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expo App Doesn't Load on Android

See original GitHub issue

I created a new repo from this template, followed the quickstart guidelines, and got this error from expo:

Error: Unable to resolve module ./index.ts from C:\Users\...\apps\expo/.: 
 
None of these files exist:
   * index.ts(.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)
   * index.ts\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)
     at ModuleResolver.resolveDependency (C:\Users\...\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:153:15)
     at DependencyGraph.resolveDependency (C:\Users\...\node_modules\metro\src\node-haste\DependencyGraph.js:276:43)        
     at C:\Users\...\node_modules\metro\src\lib\transformHelpers.js:171:21
     at Server._resolveRelativePath (C:\Users\...\node_modules\metro\src\Server.js:1256:12)
     at async Server.requestProcessor [as _processBundleRequest] (C:\Users\...\node_modules\metro\src\Server.js:529:37)     
     at async Server._processRequest (C:\Users\...\node_modules\metro\src\Server.js:449:9)

index.ts is definitely in the expo home directory.

What I’ve tried:

  1. Searching up different issues related to “Expo”, “Unable to resolve module”, and “None of these files exist”
  2. Changing the value of “main” in expo’s package.json
  3. Creating a new t3-turbo repo using a different laptop, and a different phone (Do not have a mac, or iPhone)
  4. Creating a brand new expo app using create-expo-app, but then running pnpm install in it.

Results:

  • My hunch is that number 4 is the best lead to solving the problem. For this experiment, I made two expo apps using create-expo-app. For one app, I ran npm install (even if it was unnecessary), and in the other, I ran pnpm install. The npm app ran exactly as expected, but the pnpm app gave the exact same error as above (with a different “main” file). I then tried running npm install in the pnpm app; 2 packages were added and 5 packages were changed. I then ran the pnpm expo app again, and it ran like normal.
  • There were a bunch of results that seemed to be related to my searching (1), but I don’t think any of them were this exact problem. It seemed to be a bunch of actual packages that were missing, and a lot of the solutions to their problems were to fix the way something was imported, or to install a new package.
  • Changing the value of “main” (2) would give errors if the path didn’t exist. I thought it was possible that the directory it was running from may be different that expected, but after testing a bunch of different paths, it seems like this isn’t the case. In normal expo apps, the “main” file is “./node_modules/expo/AppEntry”. I tried different variations of this too, but was still either given the error above, or the “path doesn’t exist” error
  • As for experiment 3, this may be a problem with how I’ve installed things. I am the common denominator. I did a fresh install of practically everything on new devices though (Android Studio, Expo, setting up env vars, etc.), and at the end of everything, I got the exact same error as given above

Is anyone else able to reproduce this issue? Any ideas about what may be wrong?

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cervantes-xcommented, Dec 20, 2022

I am experiencing the same issue. I managed to get Expo Go running again by changing react to version 18.1.0.

As a side effect I’m now unable to create a build. I’m getting the following error message during the gradlew step:

[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/node_modules/expo/android/build.gradle' line: 9
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':expo'.
[stderr] > Cannot invoke method multiply() on null object
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/node_modules/expo/android/build.gradle' line: 79
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ':expo'.
[stderr] > Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 54s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

I’m not sure why but when I change all the react versions in the monorepo to use 18.1.0 the builds start to work again. I feel like there is something wrong with the configuration not fetching the packages from the correct location.

0reactions
juliusmarmingecommented, Dec 24, 2022

Running npx expo-cli doctor --fix-dependencies in the expo app directory fixes this for me, but I have only tested the expo app with Android.

I hope Expo SDK 48 isn’t too far out so that we can use React 18.2 with full support - although I haven’t noticed it not working as it is now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to connect Android phone to my project with Expo
I was having the same issue, the solution is easy just make a Firewall rule that allows connection from your mobile device to...
Read more >
5 common errors found in a React Native app (using Expo)
When creating a mobile app with React Native, you can use Expo to streamline some complexities. Meet the most common errors and how...
Read more >
Expo Client doesn't open in android · Issue #8752 - GitHub
The app freezes in splash sreen. I can't even open the camera to get the QR code to emulate my project. Is there...
Read more >
Troubleshooting build errors and crashes - Expo Documentation
Go to your build details page (find it on the build dashboard if you don't have it open already) and expand any failed...
Read more >
Expo Something Went Wrong : 1 Expo React Native Tip You ...
We consider one important expo react native trick that you should know to help you solve many connection problems. This includes expo app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found