React-Native 0.57 和 Storybook 兼容性问题

Posted

技术标签:

【中文标题】React-Native 0.57 和 Storybook 兼容性问题【英文标题】:React-Native 0.57 and Storybook compatibility issues 【发布时间】:2019-02-21 14:23:12 【问题描述】:

我一直在尝试让 Storybook 3.4.4 与 react 0.57 一起工作。我最近从 0.55.4 升级,一切似乎都很好。

我还使用 babel-upgrade 工具升级到了 babel 7。

现在当我尝试运行我的 Storybook 时...

storybook start -p 7007

react-native run-android

我收到以下错误...


A problem occurred configuring project ':app'.

 Could not resolve all dependencies for configuration ':app:_debugApk'.

 A problem occurred configuring project ':react-native-vector-icons'.

 Could not resolve all dependencies for configuration ':react-native-vector-icons:_debugPublishCopy'.

 Could not find com.android.support:appcompat-v7:27.1.1.
           Searched in the following locations:
               file:/Users/[XXX]/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom

file:/Users/[XXX]/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar

file:/Users/[MY PROJECT LOCATION]/android/sdk-manager/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
           Required by:
               boilerplate:react-native-vector-icons:unspecified > com.facebook.react:react-native:0.57.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 9.08 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

谁能帮帮我?

【问题讨论】:

你可能需要更新你的androidBuildTools,见***.com/questions/39519515/… 【参考方案1】:

如果storybook start -p 7007 运行正常,则该问题与babelstorybook 无关。

根据您的堆栈跟踪,您的错误一定来自项目根目录下的 build.gradle

确保您的依赖项中有正确的 maven 存储库。

你应该看看这个问题:https://github.com/react-community/lottie-react-native/issues/343

【讨论】:

以上是关于React-Native 0.57 和 Storybook 兼容性问题的主要内容,如果未能解决你的问题,请参考以下文章

react-native 0.57 run-ios 失败解决办法

React-Native Metro 捆绑器无法提供任何文件

0.57 * 100 === 56.99999999999999 之谜

由于 SecureRandom,Tomcat 7.0.57 启动缓慢

敏捷开发——User Story

需求收集实例三之 FM