Hi so I'm trying to create an android app within react-native within the app i'm trying to use react-navigation and i get the following error when i run the program with npx react-native run-android
error: Error: Unable to resolve module `#react-navigation/stack` from `src\nav\nav.js`: #react-navigation/stack could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\node-haste\DependencyGraph.js:287:16)
at Object.resolve (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\lib\transformHelpers.js:267:42)
at C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:434:31
at Array.map (<anonymous>)
at resolveDependencies (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:431:18)
at C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
I've tried many things including using yarn instead of npm when trying to build the program. I've also tried deleted node_modules and removing react-navigation from packages.json and even npm install --save react-navigation
Do you also have all the dependencies installed? react-native-gesture-handler, react-native-reanimated, react-native-screens and react-native-safe-area-context and #react-native-community/masked-view
Related
I follow the steps of react-native docs.
npx react-native init SelfApp --template react-native-template-typescript
and then follow the steps of react-native-navigation.
yarn add #react-navigation/native
yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
then i add code
import 'react-native-gesture-handler';
to the first line of app.tsx.
then run yarn start, I got this error.
i tried a lot of times, but still in trouble, and here is my package.json
Hey according to this discussion on react-native-gesture-handler's GitHub, it's either a problem of linking, if you are on Android or a problem of some pods not being installed if you are on iOS.
It would be helpful to know which version of React Native you are using because if it's >= 60, it should support auto-linking, and if it is < 60, you should link the library manually.
In that last case:
Try these steps
For iOS:
$ cd ios
$ pod install
Another possible solution that has worked for other people, according to the discussion I mentioned above (see this specific response):
1 - Delete/Remove your node_modules directory
rm -rf node_modules
2 - Install your dependencies again
If you are using Yarn $ yarn install or if you are using npm npm install
3 Clean your Gradle
cd android
./gradlew clean
cd ..
react-native run-android
I tried to re install react package but still did not fix it
Error: Cannot find module './launchEditor'
Doing a "fresh" install will work with Yarn or npm:
rm -rf node_modules package-lock.json
npm install
I am getting an error when I am running my application:
error: Error: Unable to resolve module `#react-native-community/art` from `node_modules/react-native-pie/src/Pie.js`: #react-native-community/art could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (/Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (/Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph.js:287:16)
at Object.resolve (/Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/lib/transformHelpers.js:267:42)
at /Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:434:31
at Array.map (<anonymous>)
at resolveDependencies (/Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:431:18)
at /Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/mayankbudhiraja/Desktop/appcorona/node_modules/#react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
What I did to correct the error?
I tried running the above mentioned steps (didn't worked)
Tried reinstalling the Pie Chart (didn't worked)
Deleted entire node_modules (didn't worked)
Can you please help me with the issue?
For react-native-pie >= 1.1.0 install peer dependency
NPM
npm i --save #react-native-community/art
OR
Yarn
yarn add #react-native-community/art
I am getting an error when I build my project on Android
error: bundling failed: Error: Unable to resolve module buffer from E:\SUNNYCLOCK-MOBILE\node_modules\safe-buffer\index.js: Module
buffer does not exist in the Haste module map
This might be related to
https://github.com/facebook/react-native/issues/4968 To resolve try
the following:
1. Clear watchman watches: watchman watch-del-all.
2. Delete the node_modules folder: rm -rf node_modules && npm install.
3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf
/tmp/haste-map-react-native-packager-*.
at ModuleResolver.resolveDependency (E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:161:1460)
at ResolutionRequest.resolveDependency (E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:91:16)
at DependencyGraph.resolveDependency (E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\node-haste\DependencyGraph.js:272:4579)
at dependencies.map.relativePath (E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\DeltaBundler\traverseDependencies.js:376:19)
at Array.map ()
at resolveDependencies (E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\DeltaBundler\traverseDependencies.js:374:16)
at E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\DeltaBundler\traverseDependencies.js:212:33
at Generator.next ()
at step (E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\DeltaBundler\traverseDependencies.js:297:313)
at E:\SUNNYCLOCK-MOBILE\node_modules\metro\src\DeltaBundler\traverseDependencies.js:297:473
BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓░░░░░░░░ 51.9% (813/1143),
failed.
my React native info is
Environment:
OS: Windows 10
Node: 8.9.1
Yarn: 1.7.0
npm: 4.6.1
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4
How can I solve this issue
First Install the missing dependency buffer :
npm install buffer --save OR yarn add buffer
Second
Up in the top of your file using buffer:
import { Buffer } from 'buffer';
global.Buffer = Buffer;
If you don't need to access Buffer directly, just paste the above code in your App.js file
This question already has answers here:
Unable to resolve module `#babel/runtime/helpers/interopRequireDefault`
(17 answers)
Closed 4 years ago.
I want to build project with Native Code in React Native, but have a problem.
I used official docs on https://facebook.github.io/react-native/docs/getting-started.html, but after react-native run-android i get an error
1
Can you help me?
The development server returned response error code: 500
URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
Body:
{"originModulePath":"D:\\Develop_Drafts\\projectname\\index.js","targetModuleName":"#babel/runtime/helpers/interopRequireDefault","message":"Unable to resolve module `#babel/runtime/helpers/interopRequireDefault` from `D:\\Develop_Drafts\\projectname\\index.js`: Module `#babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map\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 `#babel/runtime/helpers/interopRequireDefault` from `D:\\Develop_Drafts\\projectname\\index.js`: Module `#babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map\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 `#babel/runtime/helpers/interopRequireDefault` from `D:\\Develop_Drafts\\projectname\\index.js`: Module `#babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map\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 (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ModuleResolution.js:209:1301)\n at ResolutionRequest.resolveDependency (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ResolutionRequest.js:83:16)\n at DependencyGraph.resolveDependency (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:238:485)\n at Object.resolve (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\lib\\transformHelpers.js:180:25)\n at dependencies.map.result (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:311:29)\n at Array.map (<anonymous>)\n at resolveDependencies (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:307:16)\n at D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:164:33\n at Generator.next (<anonymous>)\n at step (D:\\Develop_Drafts\\projectname\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:266:307)"}
processBundleResult
BundleDownloader.java:296
access$200
BundleDownloader.java:37
onResponse
BundleDownloader.java:174
execute
RealCall.java:153
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1162
run
ThreadPoolExecutor.java:636
run
Thread.java:764
enter image description here
Try this.
npm add #babel/runtime
npm install