提问者:小点点

尝试创建发布捆绑包时,无法解析模块“AccessibilityInfo”


我在跑步

react-native bundle --platform windows --dev false --entry-file index.windows.js --bundle-output windows/app/ReactAssets/index.windows.bundle --assets-dest windows/app/ ReactAssets/

创建发布包的命令,但我得到以下错误

Unable to resolve module `AccessibilityInfo` from `C:\Users\godha.pranay\project\node_modules\react-native\Libraries\react-native\react-native-implementation.js`: Module does not exist in the 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 $TMPDIR/react-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf $TMPDIR/haste-map-react-native-packager-*`.

我试了网上推荐的所有东西,都没用。我完全陷进去了。请帮帮忙。


共3个答案

匿名用户

这似乎是 0.56 中与依赖项相关的错误。“解决方案”是找到依赖项版本的正确组合。我们通过完全安装这些版本找到了解决方法:

react-native >> 0.55.4
babel-core >> latest 
babel-loader >> latest
babel-preset-react-native >> 4.0.0

因此,您必须按顺序运行这些命令:

react-native init AwesomeProject
cd AwesomeProject
react-native run-android
npm uninstall react-native
npm install --save react-native@0.55.4
react-native run-android
npm install --save babel-core@latest babel-loader@latest
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native@4.0.0
react-native run-android

匿名用户

如果您运行的是反应式本机版本0.56.0,则将其降级为0.55.4。

cd "on your project directory"
npm install react-native@0.55.4

如果你想知道原因,请关注这个问题。

匿名用户

我也有同样的问题。

以前我的反应原生版本是

C:\WINDOWS\system32>react-native -v
react-native-cli: 2.0.1
react-native: 0.56.0

然后卸载react native

C:\WINDOWS\system32>npm uninstall -g react-native-cli
removed 41 packages in 3.999s

然后我安装了反应原生

npm install react-native@0.55.4

再次被卷入

npm install -g react-native-cli@1.2.0

然后,创建react原生项目的安装就完成了

react-native init --version="0.55.4" myprojectname