Closed
Description
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 |
Activity
hampelm commentedon Jan 12, 2018
I'm seeing a similar error with React-Native 0.52.0, but not with 0.49.0.
sajsanghvi commentedon Jan 12, 2018
me too
bensie commentedon Jan 13, 2018
Same here!
sunweiyang commentedon Jan 13, 2018
It's happening for me too, with
MaterialCommunityIcons
andMaterialIcons
.Edit: I only started encountering this issue when I updated React Native from 0.51.0 => 0.52.0.
chrismcleod commentedon Jan 13, 2018
The file it is trying to find does in fact declare that module.
This is why it breaks now:
facebook/metro#139 (comment)
Related issue:
#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
ahadcove commentedon Jan 13, 2018
@chrismcleod Oh wow that worked wonders. Thank you
karlmosenbacher commentedon Jan 13, 2018
@chrismcleod genius! 😄
vovkasm commentedon Jan 13, 2018
@chrismcleod thanks for finding!
I can workaround this for RN 0.52.0 with this
rn-cli.config.js
in my project root: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...
mortezaalizadeh commentedon Jan 14, 2018
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.
react-native-vector-icons/Ionicons
, the Haste packagereact-native-vector-icons
was found. However the moduleIonicons
could not be found within the package #627psycura commentedon Jan 15, 2018
After this command rm ./node_modules/react-native/local-cli/core/fixtures/files/package.json
the application is stuck with strange error:
ahadcove commentedon Jan 16, 2018
@psycura
Stop the server that's running and then start it.
psycura commentedon Jan 16, 2018
Its not helping.
Tried to stop and start again many times.
Forced to downgrade to previous version of RN
gastonmorixe commentedon Jan 16, 2018
I added this to
package.json
using RN v0.5294 remaining items