yes
yes
Environment:
OS: macOS Sierra 10.12.6
Node: 6.9.2
Yarn: Not Found
npm: 5.6.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0
App starts successfully
Error is shown:
```
error: bundling failed: Error: While resolving modulereact-native-vector-icons/MaterialIcons, the Haste packagereact-native-vector-iconswas found. However the moduleMaterialIcons` 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)````
As per https://github.com/oblador/react-native-vector-icons/issues/626
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
It looks like this file is outdated for some time, I'm not sure if it needs to be there but it should either be updated or removed. For some reason it refers directly to the react-native-vector-icons project.
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__.*/])
},
}
It seems some blacklist items were lost in the process of moving from RN to metro :-/
@vovkasm Thanks, where do we add this file? At the root of the app?
@afilp rn-cli.config.js should be located in the root directory of the project. It is location where RN will find it automatically (https://github.com/facebook/react-native/issues/7271). Seems this info not documented.
Try this
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
@CityLifeCorp Thanks, I think though that we should not do this because next time we 'npm i' (or a colleague does this on her computer) the change will be lost. At least rn-cli.config.js will be committed to GIT, so everyone will have it when working with the project and no further action will be needed.
This is why I believe a 'permanent' change needs to be made in 'react-native' logic itself and be released in a next version.
Hello guys, just sent a PR with a fix, hope it helps everyone
I don't think that package.json from version 1.0.0 of react-native-vector-icons needs be in the react-native repo at all. As far I can see, there were references to the com.oblador.vectoricons.VectorIconsPackage in local-cli/link/__fixtures__/android/0.17/patchedMainActivity.java and local-cli/link/__fixtures__/android/0.18/patchedMainActivity.java but these are outdated/no longer required?
Edit: Updated my comment after further research.
@dazweeja
If you delete local-cli/core/__fixtures__/files/package.json this test will fail:
local-cli/core/__tests__/findAssets.spec.js.
I think that it was not supposed to be "package.json from old version of react-native-vector-icons", instead it was added as "package.json from some real module to test RN behavior with real-world complicated example". I think it totally valid to have any package.json or other files with any content in repo for tests.
But __fixtures__ directories as collection of data for tests definitely should not be included in module search paths.
@vovkasm
Thanks. That explanation makes sense. The PR from @t4deu seems like a good solution in that case.
@vovkasm
Your solution worked for me. Thank you. But Could you tell why the issue is accruing? I ma new to react-native
@Yandamuri Sorry I couldn't. I'am only one of many developers that use RN in their work... But it seems real issue is #17677 and what I know is that issue was introduced between version 0.51.0 and 0.52.0 of RN.
will this fix be available in 0.54?
Would like to backport this commit to 0.53-stable as well !
cc @grabbou
Oh, yeah, it's unfortunate. I'll cherry-pick that onto both branches and let it wait for a while before next release to make sure I catch all the commits.
Most helpful comment
Workaround: addition of
rn-cli.config.js(for RN 0.52 at least):It seems some blacklist items were lost in the process of moving from RN to metro :-/