Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6291

Error: Unable to resolve module react-native

$
0
0

Using react native with typescript template, no expo, Everything was working well, until i tried to add react-native-image-picker, i thought i'd fixed it, but somehow i get a lot of trouble with my modules,, the build is successful, but metro keeps giving me this error :

error: Error: Unable to resolve module react-native from C:\Users\index.js: react-native could not be found within the project or in these directories:node_modules3 | */4 |

5 | import {AppRegistry} from 'react-native';| ^6 | import App from './src/App';7 | import {name as appName} from './app.json';8 |at ModuleResolver.resolveDependency (C:\Users\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:162:15)at DependencyGraph.resolveDependency (C:\Users\node_modules\metro\src\node-haste\DependencyGraph.js:260:43)at Object.resolve (C:\Users\node_modules\metro\src\lib\transformHelpers.js:177:21)at Graph._resolveDependencies (C:\Users\node_modules\metro\src\DeltaBundler\Graph.js:432:35)at Graph._processModule (C:\Users\\node_modules\metro\src\DeltaBundler\Graph.js:218:38)at async Graph._traverseDependenciesForSingleFile (C:\Users\node_modules\metro\src\DeltaBundler\Graph.js:207:5)at async Promise.all (index 0)at async Graph.initialTraverseDependencies (C:\\node_modules\metro\src\DeltaBundler\Graph.js:191:5)at async DeltaCalculator._getChangedDependencies (C:\\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:196:25)at async DeltaCalculator.getDelta (C:\Users\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:90:16)

i tried deleting my node_modules and run npm install, it didn't work, tried starting metro with --reset-cache, upgraded all my packages with yarn and changed the package-lockI checked node_modules, and react-native is there, latest version !tried debugging the problematic typescript view :

Uncaught SyntaxError C:\Users\Views\CreateProfileView\CreateProfileView.tsx:1import React from 'react';^^^^^^

SyntaxError: Cannot use import statement outside a moduleat internalCompileFunction (internal/vm:74:18)at wrapSafe (internal/modules/cjs/loader:1141:20)at Module._compile (internal/modules/cjs/loader:1182:27)at Module._extensions..js (internal/modules/cjs/loader:1272:10)at Module.load (internal/modules/cjs/loader:1081:32)at Module._load (internal/modules/cjs/loader:922:12)at executeUserEntryPoint (internal/modules/run_main:81:12)at (internal/main/run_main_module:23:47)

the emulator screen is all red and returns error code 500 with same message as metroI've been trying to create my first app for months now, started a complete newbie, i would really appreciate your help


Viewing all articles
Browse latest Browse all 6291

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>