Unable to resolve module AccessibilityInfo from XXX
android启动后大红屏错误, 具体信息是这个
Unable to resolve module `AccessibilityInfo` from `xxx\node_modules\react-native\Libraries\ react-native\react-native-implementation.js`: Module does not exist in the module mapThis might be related to https://github.com/facebook/react-native/issues/4968To 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 $TMPDIR/react-*` or `npm start -- --reset-cache`. 4. Remove haste cache: `rm -rf $TMPDIR/haste-map-react-native-packager-*`.12345678910
现在安装的是最新的ReactNative(现在是0.56), 这个问题可能是新版本的bug, 降级到0.55即可.
降级流程:
1. 在工程目录下执行 E:\ReactNative\Test>npm install --save react-native@0.55.4
;
2. 然后 E:\ReactNative\Test>react-native upgrade
, 这里会提示你要不要覆盖原来的部分文件, 我是一路y, 最后提示 Successfully upgraded this project to react-native v0.55.4
;
3. 接下来再运行, 提示一个android目录下build错误, 我猜应该是build旧文件的错误, 所以删掉了android目录下的几个build文件夹;
4. 又有问题( 如果没有这么多问题就跳过这些步骤 ): MainApplication 内找不到 BuildConfig ,代码问题好办, 用AS打开, import BuildConfig 就可以了.
另外, Unable to resolve module react-navigation from
可以用 npm install react-navigation@https://github.com/react-community/react-navigation.git --save
解决.
至此, mission complete, 来到下一个问题(手动滑稽)
Module build failed: Error: Plugin 0 specified in “base” … provided an invalid property of “default”
也是个大红屏错误, 是在babel-preset-react-native包里的文件错误, 看了下那个文件, 没有几行代码.
最后在 https://github.com/facebook/react-native/issues/15545 的回答中找到适合我的方法.
执行 npm install --save-dev babel-preset-react-native@2.1.0
后再次运行即可, 终于看到梦寐以求的界面了
原文: https://blog.csdn.net/j550341130/article/details/81027700
推荐您阅读更多有关于“”的文章