Unable to resolve module \expo\AppEntry React-native error - react-native

Hi i was working on project and everything worked before i added
npm install expo-barcode-scanner
after that i added some code on the screen tried to run it on expo and got an error :
Error: Unable to resolve module ./node_modules\expo\AppEntry from C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3/.:
None of these files exist:
node_modules\expo\AppEntry(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
node_modules\expo\AppEntry\index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
at ModuleResolver.resolveDependency (C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:152:15)
at DependencyGraph.resolveDependency (C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3\node_modules\metro\src\node-haste\DependencyGraph.js:264:43)
at C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3\node_modules\metro\src\lib\transformHelpers.js:170:21
at Server._resolveRelativePath (C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3\node_modules\metro\src\Server.js:1196:12)
at async Server.requestProcessor [as _processBundleRequest] (C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3\node_modules\metro\src\Server.js:484:37)
at async Server._processRequest (C:\Users\jacek\OneDrive\Pulpit\Neonki\neonkiV3\node_modules\metro\src\Server.js:435:9)
i checked AppEntry.js in node_modules\expo and the path to App.js is correct
reinstalled expo and the error still occurs
Does someone know how to fix it?

Related

Unable to run npx react-native init

I keep getting this error:
✖ Installing Bundler
error /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /Users(my path here)/ in PATH, mode 040777
✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
at createFromTemplate
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.initialize [as func]
Ive spent too long on this, someone please help

react native expo debugger-ui Error: EISDIR: illegal operation on a directory, read

I started a new app using expo
but when I try to open the debugger-ui
with cmd-d and click on debug remote js
I've got this ugly message:
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (node:fs:720:3)
at tryReadSync (node:fs:430:20)
at Object.readFileSync (node:fs:476:19)
at UnableToResolveError.buildCodeFrameMessage (/Users/me/my/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:304:17)
at new UnableToResolveError (/Users/me/my/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (/Users/me/my/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (/Users/me/my/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
at /Users/me/my/node_modules/metro/src/lib/transformHelpers.js:271:42
at Server.<anonymous> (/Users/me/my/node_modules/metro/src/Server.js:842:41)
at Generator.next (<anonymous>)
I tried googling but none of the solution works
Any idea to fix it?
It's a React-native issue; the error is linked to the metro dependencies inside node_modules.
The EISDIR error is likely to be a misreported error due to a bug in metro that has been fixed in metro 0.65.
Some methods of troubleshooting can be found here.
I uninstalled the Expo Go app from my phone, and then downloaded & installed it again, and it worked.
I ran into the same problem while I was changing some npm settings. I did a mistake with one npm config set command and this added a line referring to a non-existing directory to C:\Users\{User}\.npmrc. After I deleted that line manually from .npmrc, the problem was gone.

bundling failed: Error: While resolving module `metro/src/lib/bundle-modules/HMRClient`

I have created a new project called metro. when I run it, this error appears on my cli nodejs:
error: bundling failed: Error: While resolving module metro/src/lib/bundle-modules/HMRClient, the Haste package metro was found. However the module src/lib/bundle-modules/HMRClient could not be found within the package. Indeed, none of these files exist:
D:\programming\react native\metro\src\lib\bundle-modules\HMRClient(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
D:\programming\react native\metro\src\lib\bundle-modules\HMRClient\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at resolveHasteName (D:\programming\react native\metro\node_modules\metro-resolver\src\resolve.js:236:9)
at Object.resolve (D:\programming\react native\metro\node_modules\metro-resolver\src\resolve.js:103:20)
at ModuleResolver.resolveDependency (D:\programming\react native\metro\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:143:31)
at ResolutionRequest.resolveDependency (D:\programming\react native\metro\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (D:\programming\react native\metro\node_modules\metro\src\node-haste\DependencyGraph.js:283:16)
at Object.resolve (D:\programming\react native\metro\node_modules\metro\src\lib\transformHelpers.js:261:42)
at dependencies.map.result (D:\programming\react native\metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:399:31)
at Array.map (<anonymous>)
at resolveDependencies (D:\programming\react native\metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:18)
at D:\programming\react native\metro\node_modules\metro\src\DeltaBundler\traverseDependencies.js:269:33
my react-native version is 0.59.8
I was stuck in the same issue,
So what I did was:
Find the file at the path: node_modules/react-native/Libraries/Utilities/HMRClient.js
Change the line: const MetroHMRClient = require('metro/src/lib/bundle-modules/HMRClient');
To: const MetroHMRClient = require('../../../#react-native-community/cli/node_modules/metro/src/lib/bundle-modules/HMRClient');
Was the only thing that worked for me, the only issue is that if you reinstall de node_modules you will need to replace the line again. Because that I added this script to my package.json:
"postinstall": "sed -i '' \"s#metro#../../../#react-native-community/cli/node_modules/metro#g\" ./node_modules/react-native/Libraries/Utilities/HMRClient.js"
The above script takes care of the replacing after each new npm install
I had the same issue after updating react-native to v0.59.8.
What I ended up doing was adding a dev dependency to metro package with npm install --save-dev metro which is currently at v0.54.1.
This solved it for me!
Becouse I named this project metro the problem had occured. I create a new project with new name the problem is solved.

Error: While trying to resolve module 'prop-types' from file

Error when I run the command react-native run-android. The error was on metro bundler, when, the app is installing on my device, always shows this error.
The curious thing is that only happens me in this PC, I used other PC for a long time and when I pull git repo here (previously I was able to develop and test on that PC too), it's impossible to get it working for this error...
I think that maybe could be I removed yarn.lock many days ago and when I run npm install here produces this error?
I ommited my path for logic reasons:
Loading dependency graph, done.
error: bundling failed: Error: While trying to resolve module `prop-types` from file `PATH_TO_PROJECT_FOLDER\node_modules\react-redux\lib\components\Provider.js`, the package `PATH_TO_PROJECT_FOLDER\node_modules\react-redux\node_modules\prop-types\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`PATH_TO_PROJECT_FOLDER\node_modules\react-redux\node_modules\prop-types\index`. Indeed, none of these files exist:
* `PATH_TO_PROJECT_FOLDER\node_modules\react-redux\node_modules\prop-types\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
* `PATH_TO_PROJECT_FOLDER\node_modules\react-redux\node_modules\prop-types\index\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
at ResolutionRequest.resolveDependency (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:65:15)
at DependencyGraph.resolveDependency (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\node-haste\DependencyGraph.js:283:16)
at Object.resolve (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\lib\transformHelpers.js:261:42)
at dependencies.map.result (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\DeltaBundler\traverseDependencies.js:399:31)
at Array.map (<anonymous>)
at resolveDependencies (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:18)
at PATH_TO_PROJECT_FOLDER\node_modules\metro\src\DeltaBundler\traverseDependencies.js:269:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
at _next (PATH_TO_PROJECT_FOLDER\node_modules\metro\src\DeltaBundler\traverseDependencies.js:107:9)
DELTA [android, dev] ..\..\../index.android.js ▓▓▓▓▓▓▓▓░░░░░░░░ 51.9% (610/847), failed.
react-native: 0.59.1
react-native-cli: 2.0.1
Well.. I should not have deleted the yarn.lock file.
To fix:
Delete all .lock files on root folder project as #hend-el-sahli said.
yarn install
If you had the error unable to resolve module ./index, see that thread https://github.com/facebook/react-native/issues/24112
:)

How can I fix this react-native iOS error?

error: bundling failed: Error: While trying to resolve module `react-native` from file `/Users/ios/Desktop/android/android/index.js`, the package `/Users/ios/Desktop/android/android/node_modules/react-native/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/ios/Desktop/android/android/node_modules/react-native/Libraries/react-native/react-native-implementation.js`. Indeed, none of these files exist:
* `/Users/ios/Desktop/android/android/node_modules/react-native/Libraries/react-native/react-native-implementation.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
* `/Users/ios/Desktop/android/android/node_modules/react-native/Libraries/react-native/react-native-implementation.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
at ResolutionRequest.resolveDependency (/Users/ios/Desktop/android/android/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:103:15)
at DependencyGraph.resolveDependency (/Users/ios/Desktop/android/android/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579)
at dependencies.map.relativePath (/Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19)
at Array.map (<anonymous>)
at resolveDependencies (/Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:374:16)
at /Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:212:33
at Generator.next (<anonymous>)
at step (/Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:313)
at /Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:473
at <anonymous>
Did you upgrade your react-native recently? If yes, then that might be the issue.
If not, check your node_modules folder for the file.
If nothing works, Then try this:
Delete the node_modules folder and close the packager.
Then reinstall using the command npm install from your project directory.