Unable to resolve "aws-amplify" from "App.js"
See original GitHub issueToday I initialized a new react native project with Amplify.
In my app.js I want to do:
import Amplify from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
But it says: Unable to resolve "aws-amplify" from "App.js"
On my phone it says:
The development server returned response error code: 500
URL: http://192.168.1.15:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false
Body:
{"originModulePath":"/Users/Dion/www/movieproject-app/App.js","targetModuleName":"aws-amplify","message":"Unable to resolve module `aws-amplify` from `/Users/Dion/www/movieproject-app/App.js`: Module `aws-amplify` does not exist in the Haste module map or in these directories:\n /Users/Dion/www/movieproject-app/node_modules\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: `watchman watch-del-all`.\n 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n 3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n 4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.","errors":[{"description":"Unable to resolve module `aws-amplify` from `/Users/Dion/www/movieproject-app/App.js`: Module `aws-amplify` does not exist in the Haste module map or in these directories:\n /Users/Dion/www/movieproject-app/node_modules\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: `watchman watch-del-all`.\n 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n 3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n 4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`."}],"name":"Error","stack":"Error: Unable to resolve module `aws-amplify` from `/Users/Dion/www/movieproject-app/App.js`: Module `aws-amplify` does not exist in the Haste module map or in these directories:\n /Users/Dion/www/movieproject-app/node_modules\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: `watchman watch-del-all`.\n 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n 3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n 4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.\n at ModuleResolver.resolveDependency (/Users/Dion/www/movieproject-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:183:15)\n at ResolutionRequest.resolveDependency (/Users/Dion/www/movieproject-app/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)\n at DependencyGraph.resolveDependency (/Users/Dion/www/movieproject-app/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)\n at Object.resolve (/Users/Dion/www/movieproject-app/node_modules/metro/src/lib/transformHelpers.js:261:42)\n at dependencies.map.result (/Users/Dion/www/movieproject-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:399:31)\n at Array.map (<anonymous>)\n at resolveDependencies (/Users/Dion/www/movieproject-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:18)\n at /Users/Dion/www/movieproject-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:269:33\n at Generator.next (<anonymous>)\n at asyncGeneratorStep (/Users/Dion/www/movieproject-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)"}
processBundleResult
BundleDownloader.java:300
access$200
BundleDownloader.java:37
onChunkComplete
BundleDownloader.java:224
emitChunk
MultipartStreamReader.java:76
readAllParts
MultipartStreamReader.java:154
processMultipartResponse
BundleDownloader.java:208
access$100
BundleDownloader.java:37
onResponse
BundleDownloader.java:169
execute
RealCall.java:206
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1167
run
ThreadPoolExecutor.java:641
run
Thread.java:784
There are some suggestions in there:
1. Clear watchman watches: `watchman watch-del-all`.\n
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.\n
None of those work. 1: Watchman is a command that’s not found. 2: I can remove / reinstall node_modules. But the problem remains. 3: This tmp directory does not exist. 4: This tmp directory does not exist.
Hopefully, someone knows what I’m missing here.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:20 (4 by maintainers)
Top Results From Across the Web
Unable to resolve "aws-amplify" from "App.js" - Stack Overflow
I have been trying to downgrade dependencies, but that throws me down a dependency rabbit hole, where I don't want to be. Something...
Read more >Search - appsloveworld.com
[Solved]-Unable to resolve "./aws-exports" from "App.js"-Reactjs · For setting up a local dev folder, from an existing amplify repo, use an amplify env...
Read more >aws-amplify-react - npm
AWS Amplify is a JavaScript library for Frontend and mobile developers building cloud-enabled applications.. Latest version: 5.1.43, ...
Read more >unable to resolve "@react-navigation/native" from "app.js"
I'm trying to start a project with expo i.c.m Aws apmlify. It seems Amplify cannot be used with the latest version of expo....
Read more >Installation | Amplify UI for React
Install @aws-amplify/ui-react with npm or yarn: ... Modern bundlers like Create React App & Next.js allow you to import .css from within your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got same issue and the problem was with the blacklistRE param in metro.config.js. Be sure to put /#current-cloud-backend/.*/ and NOT /amplify/*./
@chai86
npm install aws-amplify@1.2.4 https://stackoverflow.com/questions/15890958/how-to-install-a-previous-exact-version-of-a-npm-package
To be honest, I just installed that version right away since I was facing multiple problems integrating aws amplify in my expo project.