After upgrading my react native project and also my react-native-vector-icons I started receiving this error.
error: bundling failed: Error: While resolving module `react-native-vector-icons/MaterialIcons`, the Haste package `react-native-vector-icons` was found. However the module `MaterialIcons` could not be found within the package. Indeed, none of these files exist:
* `/Users/user/my-app/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
* `/Users/user/my-app/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
The same issue happens with Font Awesome
Module | Version
----- | -----
React-Native | 0.52.0
React | 16.2.0
React-native-vector-icons | 4.5.0
I'm seeing a similar error with React-Native 0.52.0, but not with 0.49.0.
me too
Same here!
It's happening for me too, with MaterialCommunityIcons and MaterialIcons.
Edit: I only started encountering this issue when I updated React Native from 0.51.0 => 0.52.0.
The file it is trying to find does in fact declare that module.
This is why it breaks now:
https://github.com/facebook/metro/issues/139#issuecomment-366213751
Related issue:
https://github.com/oblador/react-native-vector-icons/issues/379
The broken file:
https://github.com/facebook/react-native/blob/master/local-cli/core/__fixtures__/files/package.json
Workaround
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
restart packager
@chrismcleod Oh wow that worked wonders. Thank you
@chrismcleod genius! π
@chrismcleod thanks for finding!
I can workaround this for RN 0.52.0 with this rn-cli.config.js in my project root:
const blacklist = require('metro/src/blacklist')
module.exports = {
getTransformModulePath () {
return require.resolve('react-native-typescript-transformer')
},
getSourceExts () {
return ['ts', 'tsx']
},
getBlacklistRE () {
return blacklist([/react-native\/local-cli\/core\/__fixtures__.*/])
},
}
Exact workaround is getBlacklistRE part (other is my typescript config).
I have very bad feelings last months about react-native, metro and other facebook js code, they always reinventing wheels with good intentions and badly broken implementations :-(
But to be more constructive... it will be very good if someone fill bug at react-native repo...
Got the same error with Ionicons and
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
workaround fixed the issue.
Loading dependency graph, done.
warning: the transform cache was reset.
error: bundling failed: Error: While resolving module react-native-vector-icons/Ionicons, the Haste package react-native-vector-icons was found. However the module Ionicons could not be found within the package. Indeed, none of these files exist:
/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/react-native/local-cli/core/__fixtures__/files/Ionicons(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)
/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/react-native/local-cli/core/__fixtures__/files/Ionicons/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)
at resolveHasteName (/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:387:9)
at ModuleResolver._resolveDependency (/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:317:37)
at ModuleResolver.resolveDependency (/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:313:877)
at ResolutionRequest.resolveDependency (/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:97:16)
at DependencyGraph.resolveDependency (/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/node-haste/DependencyGraph.js:269:4352)
at /home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:201:36
at Generator.next ()
at step (/home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:306)
at /home/morteza/projects/fingermenu/finger-menu-restaurant-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:536
at new Promise ()
BUNDLE [android, dev] ./index.android.js ββββββββββββββββ 30.5% (289/523), failed.
After this command rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
the application is stuck with strange error:
Unknown named module: 'react'
Module AppRegistry is not a registered callable module
@psycura
Stop the server that's running and then start it.
Its not helping.
Tried to stop and start again many times.
Forced to downgrade to previous version of RN
I added this to package.json using RN v0.52
"scripts": {
"postinstall": "rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.jsonβ
}
I had this problem with react-native-vector-icons, now I'm having a similar problem but with realm.
Error: While trying to resolve module 'realm' from file '/Users/guilhermeherzog/Projects/agclaims/app/utils/Storage.js', the package '/Users/guilhermeherzog/Projects/agclaims/app/realm/package.json' was successfully found. However, this package itself specifies a 'main' module field that could not be resolved ('/Users/guilhermeherzog/Projects/agclaims/app/realm/index'. Indeed, none of these files exist:
Does anyone know the solution?
[EDIT] It seems that updating my Node version resolved this problem. I don't know if this is related to React Native, but in any case, I will keep my question here.
I deleted the JSON file that others have mentioned. node_modules/react-native/local-cli/core/__fixtures__/files/package.json
Keep in mind that I am only using React Native and those icons in my project, so I'm not sure if others are running into different problems. @guiherzog mentioned having a similar problem with realm, so I get the feeling that there is something else causing the problem.
Deleting the JSON file may only be a workaround for this particular package.
hi @gastonmorixe just letting you know the trailing quotation mark in your snippet is a β instead of a "
also you can add a -f to the postinstall script to not get an npm error if the file has already been removed.
Is this an issue with react-native 0.52? or this package?
Looks like the issue is with react-native 0.52.0. Is there a bug open for this?
Stuff like this makes me worry about stability of react-native. They really need to test with their ecosystem packages.
I have the same error, but in my case I am trying to import a fontello source can someone help me? react-native 0.52
This seems to be the issue on the react-native repo: https://github.com/facebook/react-native/issues/17610
Same problem, @gastonmorixe postinstall fixes the problem, but this should be fixed in core...
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
after triger this line restart npm..
@chrismcleod You saved my night man... thank you...
We were building a project using Yarn just fine for months, but the client had this issue on their CD server. This issue occurred only when dependencies were installed using npm. The workaround from @chrismcleod works great for the time being π₯
Was experiencing the same as @psycura. Looks like that issue is potentially related to a babel-plugin: https://github.com/bvic23/babel-plugin-functional-hmr/issues/9.
I removed the plugin and the error was gone.
Use rimraf ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json for windows
@pritishvaidya Why you and others need to delete this file??? I think rm in postinstall section of package.json is very bad hack itself, but make it crossplatform with additional deps, ever more strange )))
Why not simple use more controlled way to configure RN cli that already exists - rn-cli.config.js?
@vovkasm, could you give details of your proposal?
@ujwal-setlur Ok, I copy some info from actual bug report: facebook/react-native#17610 (your can read the thread to get more interesting info, e.g. real issue seems to be different facebook/react-native#17677)
Workaround: addition of rn-cli.config.js (for RN 0.52 at least):
const blacklist = require('metro/src/blacklist')
module.exports = {
getBlacklistRE () {
return blacklist([/react-native\/local-cli\/core\/__fixtures__.*/])
},
}
rn-cli.config.js should be located in the root directory of the project. It is location where RN will find it automatically (facebook/react-native#7271). Seems this info not documented.
rn-cli.config.js is a config for RN cli utils, it is very useful itself (not only for blacklisting directories for packager). You can use custom translator for js (e.g. to write project in typescript), you can add polifills to bundle etc...
Unfortunate there is no documetation except code itself and code spread between RN and metro packages, but it is still can be located:
I think this is acceptable workaround for projects until RN will fix its module resolving algorithm.
https://github.com/facebook/react-native/pull/17672 will fix this. It's not a problem from this repo.
This is a problem on react-native 0.52.2 also
Attempting import Ionicons from 'react-native-vector-icons/Ionicons';
From the docs here https://reactnavigation.org/docs/tab-based-navigation.html
error: bundling failed: Error: While resolving module `react-native-vector-icons/Ionicons`, the Haste package `react-native-vector-icons` was found. However the module `Ionicons` could not be found within the package. Indeed, none of these files exist:
* `/Users/g/Dev/MySampleApp/node_modules/react-native/local-cli/core/__fixtures__/files/Ionicons(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
* `/Users/g/Dev/MySampleApp/node_modules/react-native/local-cli/core/__fixtures__/files/Ionicons/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
at resolveHasteName (/Users/g/Dev/MySampleApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:385:9)
at ModuleResolver._resolveDependency (/Users/g/Dev/MySampleApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:315:37)
at ModuleResolver.resolveDependency (/Users/g/Dev/MySampleApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:311:877)
at ResolutionRequest.resolveDependency (/Users/g/Dev/MySampleApp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:96:16)
at DependencyGraph.resolveDependency (/Users/g/Dev/MySampleApp/node_modules/metro/src/node-haste/DependencyGraph.js:269:4352)
at /Users/g/Dev/MySampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:201:36
at Generator.next (<anonymous>)
at step (/Users/g/Dev/MySampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:306)
at /Users/g/Dev/MySampleApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:536
at new Promise (<anonymous>)
DELTA [android, dev] ./index.js ββββββββββββββββ 41.3% (250/389), failed.
I'm just gonna switch to native apps at this point. Everyday something is broken. Thanks
@chrismcleod thanks that totally worked but I am curious as to what made think about that?
https://github.com/facebook/react-native/issues/17610
Will be fixed by https://github.com/facebook/react-native/pull/17672
https://github.com/oblador/react-native-vector-icons/issues/626#issuecomment-362386341
@chrismcleod Thanks. The workaround works. But, like @codejunky I am also curious why this works.
@chrismcleod Thanks a lot.
@andela-ookwuolisa @codejunky this works bc the packager searches for a package.json file in the whole node_modules tree recursively and stops once it finds the first one (loosely). This comment provides the best explanation for what is happening: by @jeanlauliac: https://github.com/facebook/metro/issues/139#issuecomment-366213751
I should have just looked at the file to begin with but what I actually did was inspect the metro bundler source code and start console logging things. I noticed it appeared to say the packager was finding the package in that folder and thought that was weird and only then did I look to see what that package.json file contained. And low and behold, a definition for the react-native-vector-icons package.
@kuldeepoza14 new update seem change the folder to ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json instead of rm ./node_modules/react-native/local-cli/core/fixtures/files/package.json in mac also .Thanks @pritishvaidya
What worked for me...
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
Then I received another metro bundle error about
Couldn't find preset "babel-preset-react-native-stage-0/decorator-support"
so I reinstalled
yarn remove babel-preset-react-native
yarn add [email protected]
Same original bundle error about Ionicons came back. So, did this again
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
And now it all works.
okay, back to normal again .. :+1:
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
yarn remove react-native-vector-iconsyarn add react-native-vector-iconsrm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.jsonafter updating to [email protected] helped me out
Guys, just follow these instructions: https://github.com/oblador/react-native-vector-icons/issues/626#issuecomment-362386341
And wait for the next release: https://github.com/oblador/react-native-vector-icons/issues/626#issuecomment-364106193
@chrismcleod Thank you very mach
I don't understand why that file exists in that folder. As far as I can see it's the package.json of the actual vector icons package, which is a bit weird to use as a fixture.
Add this to the package.json and run "npm install" again
"scripts": {
"postinstall": "rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json"
}
Can't believe I'm getting two new problems for every problem I have with Node and npm.
500 MB modules and then just delete everything just to start over and see the same error for a problem that should be completely unrelated (navigation and icons should be unrelated problems and I am trying to solve a navigation problem. )
If you are a masochist then I understand.
Neither of the comments helped anything here. That package.json file doesn't even exist, because neither the __fixtures__ nor the fixtures subfolders exist. Thus deleting the non-existent file doesn't help, nor does the rn-cli.config.js solution (which also involves the same non-existent file).
And I'm getting this issue -.-
@amcsi this was a bug in react native. A PR was merged since this issue was originally created that supposedly fixed it. If you are having the issue again, it might be a new cause. What version of react native are you using?
I'm having the issue for the first time, and I'm using react-native version 0.55.3.
Also, if you're talking about this PR, it isn't merged, but closed: facebook/react-native#17672
And like I said, there's no __fixtures__ or fixtures folders at all.
This is what I get by the way:
error: bundling failed: Error: Unable to resolve module `react-native-vector-icons/MaterialIcons` from `C:\0\ch_calculator_ejected\node_modules\react-native-elements\src\buttons\Button.js`: Module `react-native-vector-icons/MaterialIcons` 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 (C:\0\ch_calculator_ejected\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:161:1460)
at ResolutionRequest.resolveDependency (C:\0\ch_calculator_ejected\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:91:16)
at DependencyGraph.resolveDependency (C:\0\ch_calculator_ejected\node_modules\metro\src\node-haste\DependencyGraph.js:272:4579)
at dependencies.map.relativePath (C:\0\ch_calculator_ejected\node_modules\metro\src\DeltaBundler\traverseDependencies.js:376:19)
at Array.map (<anonymous>)
at resolveDependencies (C:\0\ch_calculator_ejected\node_modules\metro\src\DeltaBundler\traverseDependencies.js:374:16)
at C:\0\ch_calculator_ejected\node_modules\metro\src\DeltaBundler\traverseDependencies.js:212:33
at Generator.next (<anonymous>)
at step (C:\0\ch_calculator_ejected\node_modules\metro\src\DeltaBundler\traverseDependencies.js:297:313)
at C:\0\ch_calculator_ejected\node_modules\metro\src\DeltaBundler\traverseDependencies.js:297:473
BUNDLE [android, dev] ./index.js ββββββββββββββββ 20.4% (259/573), failed.
Alright I managed to solve this issue by installing react-native-vector-icons@^4.6.0 which was a peer dependency of react-native-elements.
It was strange to me, because the error message was identical to that of this issue, but the cause was completely different.
I got this issues many times.
These two options are works for me
node_modules/react-native/local-cli/core/fixtures/files/package.jsonnpm i OR
as @cedanoernesto mentioned,
Same as @129emma , only that in my case there wasn't a fixtures folder but had a __fixtures__ one.
@chrismcleod Cannot find '__fixtures__' folder under core. Please provide help.
I have the same issue here. neither fixtures and __ fixtures __ exists.
Any luck solving this issue ?
@us-22 I faced similar problems and was able to fix the issue by installing react-native-vector-icons.
npm install --save react-native-vector-icons
thanks @mevansam
You are right.
I solve it by reinstalling the package.
For others landing here after upgrading to React Native 0.53, this is resolved in React Native 0.54.4.
In my case, with react-native-vector-icons/Ionicons, I had, besides insert all the ttf fonts to Info.plist, restart my machine (OSX Sierra)
I use RN version 0.55.4 and I get this error.. Nothing helped, any idea how we can solve it?.......
Well so stupid but I didnt have vector-icons installed.
I have installed it and it fixed.. npm install react-native-vector-icons --save
This is utmost ridiculous and painful to see how version updates between frameworks crippled the whole development process. We used to see such versioning pain in case of Java developments - beside being a popular development framework (RN) how such versioning issues hits everyday life of the developers.
Thanks to @chrismcleod for mentioning an workaround. This worked for me.
Note that since RN 0.57 (currently in rc), @vovkasm's workaround with rn-cli.config.js would break react-native build as I wrote at https://github.com/facebook/react-native/issues/20799. Issue here has been fixed and merged into RN: https://github.com/facebook/react-native/commit/54dc11a5fbafaccc9c0a781f1151225909717597 so the workaround simply has to be taken out.
module.exports = {
getSourceExts: () => ['jsx', 'mjs'],
}
why it is not work? @fungilation
After upgrading my react native project and also my react-native-vector-icons I started receiving this error.
error: bundling failed: Error: While resolving module `react-native-vector-icons/MaterialIcons`, the Haste package `react-native-vector-icons` was found. However the module `MaterialIcons` could not be found within the package. Indeed, none of these files exist: * `/Users/user/my-app/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)` * `/Users/user/my-app/node_modules/react-native/local-cli/core/__fixtures__/files/MaterialIcons/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`The same issue happens with Font Awesome
Module Version
React-Native 0.52.0

I don't understand why people continue to add comments here instead of place bug reports into RN... :-)
I don't understand why people continue to add comments here instead of place bug reports into RN... :-
sorry for that.
This package breaks everything lol.
FFS, a year later and still an issue with latest versions.
@kinowarrior Please create public repo on github with application that demonstrate the issue.
I solved this issue by running the below, after initially completing the setup of iOS = Option: Manually & Android = Option: With Gradle (recommended).
1) re-ran npm i react-native-vector-icons as some people advised it worked for them
2) react-native link react-native-vector-icons in root
3) cd ios && pod update
4) cd .. && react-native start --reset-cache
5) react-native run-ios in separate terminal window
Try starting from 3) first, if you've already followed the iOS Manual & Android Gradle steps. I don't think the first 2 steps are actually necessary and pod update is the primary solution, as I've only ran pod install previously.
* EDIT: Just setup a new project and the only steps required with RN 60.5 is
1) install package
2) add apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" to app/build.gradle
3) add pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' to podfile
4) add
5) pod install
6) See earlier steps 3 - 5
Error: While resolving module App/Config, the Haste package App was found. However the module Config could not be found within the package. Indeed, none of these files exist
Getting this error, tried to solve by npm cache clean, also followed https://github.com/oblador/react-native-vector-icons/issues/626#issuecomment-357405396 but issue not fixed.
Tried to solve the issue by running rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json command, but in core directory there is no directory inside, only have one .js file.
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-vector-icons: https://github.com/oblador/react-native-vector-icons
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
error While resolving module `App/Config`, the Haste package `App` was found. However the module `Config` could not be found within the package. Indeed, none of these files exist:
* `/home/bhanwar/react_native/App/Config(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
* `/home/bhanwar/react_native/App/Config/index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`. Run CLI with --verbose flag for more details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleDebugJsAndAssets'.
> Process 'command 'npx'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 47s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (/home/bhanwar/react_native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/home/bhanwar/react_native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at /home/bhanwar/react_native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (/home/bhanwar/react_native/node_modules/@react-native-community/cli/build/index.js:164:9)
Most helpful comment
The file it is trying to find does in fact declare that module.
This is why it breaks now:
https://github.com/facebook/metro/issues/139#issuecomment-366213751
Related issue:
https://github.com/oblador/react-native-vector-icons/issues/379
The broken file:
https://github.com/facebook/react-native/blob/master/local-cli/core/__fixtures__/files/package.json
Workaround
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.jsonrestart packager