Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native can't resolve any module after update

I have an android react-native app that is running in eject mode. After updating react-native from 0.64.3 to 0.71.2 and manually updating every relevant file, it can't resolve any module when running, the first module imported in the app is 'react-native-gesture-handler', so that is the one that throws the error, but trying to import expo first, for example, resulted in the same error but with expo.

Error:

error: Error: Unable to resolve module react-native-gesture-handler from E:\SteveQueue\index.js: react-native-gesture-handler could not be found within the project or in these directories:
  node_modules
> 1 | import 'react-native-gesture-handler';
    |         ^
  2 | import { registerRootComponent } from 'expo';
  3 |
  4 | import App from './App';
    at ModuleResolver.resolveDependency (E:\SteveQueue\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:162:15)
    at DependencyGraph.resolveDependency (E:\SteveQueue\node_modules\metro\src\node-haste\DependencyGraph.js:260:43)
    at Object.resolve (E:\SteveQueue\node_modules\metro\src\lib\transformHelpers.js:177:21)
    at Graph._resolveDependencies (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:432:35)
    at Graph._processModule (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:218:38)
    at async Graph._traverseDependenciesForSingleFile (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:207:5)
    at async Promise.all (index 0)
    at async Graph.initialTraverseDependencies (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:191:5)
    at async DeltaCalculator._getChangedDependencies (E:\SteveQueue\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:196:25)
    at async DeltaCalculator.getDelta (E:\SteveQueue\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:90:16)

Build output:

> Configure project :expo

Using expo modules
  - expo-application (5.0.1)
  - expo-constants (14.0.2)
  - expo-error-recovery (4.0.1)
  - expo-file-system (15.1.1)
  - expo-font (11.0.1)
  - expo-keep-awake (11.0.1)
  - expo-modules-core (1.1.1)
  - expo-splash-screen (0.17.5)


> Task :expo-constants:createDebugExpoConfig
Execution optimizations have been disabled for task ':expo-constants:createDebugExpoConfig' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:checkDebugAarMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what 
order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:compileDebugAidl' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:compileDebugJavaWithJavac' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:compileDebugRenderscript' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about 
this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:compileDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this 
problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:createDebugCompatibleScreenManifests' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:extractDeepLinksDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what 
order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:generateDebugBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about 
this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:generateDebugResValues' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:javaPreCompileDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this 
problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:mapDebugSourceSetPaths' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:mergeDebugResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this 
problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:mergeDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:processDebugMainManifest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about 
this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:processDebugManifest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:processDebugManifestForPackage' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details 
about this problem.
  - Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of 
task ':app:processDebugResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what 
order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :expo-modules-core:downloadBoost UP-TO-DATE
Download https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'SM-G973F - 12' for :app:debug
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.

BUILD SUCCESSFUL in 35s

UPDATE: I've downgraded RN to 0.70.5 (the compatible version for my expo version) and it's still the same

like image 270
Stav Byevsky Avatar asked Mar 02 '26 17:03

Stav Byevsky


1 Answers

If you are using a metro.config.js file, you need to remove resolver section. check this solution: https://stackoverflow.com/a/76183546/9066631

like image 173
EL.Amine Avatar answered Mar 05 '26 06:03

EL.Amine