when i enter to my react native application from android device the app crash and it's throw the next error:
image of the error:
thanks for helping I try to delete node modules and reinstall and delete the app and build again and it doesn't work
This issue seems to be due to metro bundler and source maps requested by the browser (Chrome in my case), I've listed the steps below in solving this.
Note:
The patch script mentioned below is only related to [email protected]
. If you have another version, you can try modifying the script or searching through GitHub issues for metro for something related to your version.
yarn add patch-package
.package.json
file and add this line within scripts
:"postinstall": "patch-package"
mkdir patches
in your project's root directory (if you don't have one already).patches/metro+0.64.0.patch
:diff --git a/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js b/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js
index 5f32fc5..2b80fda 100644
--- a/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js
+++ b/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js
@@ -346,7 +346,7 @@ class UnableToResolveError extends Error {
try {
file = fs.readFileSync(this.originModulePath, "utf8");
} catch (error) {
- if (error.code === "ENOENT") {
+ if (error.code === "ENOENT" || error.code === 'EISDIR') {
// We're probably dealing with a virtualised file system where
// `this.originModulePath` doesn't actually exist on disk.
// We can't show a code frame, but there's no need to let this I/O
Run yarn postinstall
and it should patch [email protected]
.
In Chrome dev tools, uncheck:
Run react-native start
and you should be good to go.
Reference: GitHub => react-native-fs => Issue 991
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With