在react-native-git-upgrade之后,无法构建反应本机项目

时间:2018-04-26 15:07:14

标签: react-native react-native-android react-native-ios

我尝试将反应原生从0.49.3升级到0.55.3。我跟着官方[指南] [1],当我跑react-native-git-upgrade时,我得到了以下日志:

git-upgrade info Check for updates 
git-upgrade info Using yarn 1.5.1 
git-upgrade info Read package.json files 
git-upgrade info Check declared version 
git-upgrade info Check matching versions 
git-upgrade info Check React peer dependency 
git-upgrade info Check that Git is installed 
git-upgrade info Get information from NPM registry 
git-upgrade info Upgrading to React Native 0.55.3, React 16.3.1 
git-upgrade info Setup temporary working directory 
git-upgrade info Configure Git environment 
git-upgrade info Init Git repository 
git-upgrade info Add all files to commit 
git-upgrade info Commit current project sources 
git-upgrade info Create a tag before updating sources 
git-upgrade info Generate old version template 
git-upgrade info Add updated files to commit 
git-upgrade info Commit old version template 
git-upgrade info Install the new version 
warning " > react-native-maps@0.20.1" has incorrect peer dependency "react@16.0.0".
warning " > react-native-maps@0.20.1" has incorrect peer dependency "react-native@0.51.0".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "@storybook/addons@^3.2.13".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "@storybook/channels@^3.2.13".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "@storybook/react@^3.2.13".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "babel-core@^6.26.0".
warning "@storybook/react-native > @storybook/ui > react-icons@2.2.7" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@storybook/react-native > @storybook/ui > react-komposer@2.0.0" has incorrect peer dependency "react@^0.14.7 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-modal@2.4.1" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-modal@2.4.1" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-treebeard@2.0.3" has incorrect peer dependency "react@^15.5.4".
warning "@storybook/react-native > @storybook/ui > react-treebeard@2.0.3" has incorrect peer dependency "react-dom@^15.5.4".
warning "@storybook/react-native > @storybook/ui > mantra-core > react-komposer@1.13.1" has incorrect peer dependency "react@^0.14.3 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > mantra-core > react-simple-di@1.2.0" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-komposer > react-stubber@1.0.0" has incorrect peer dependency "react@^0.14.7 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-treebeard > velocity-react@1.3.3" has incorrect peer dependency "react-dom@^15.3.0 || ^16.0.0".
warning "@storybook/react-native > @storybook/ui > react-treebeard > velocity-react > react-transition-group@1.2.1" has incorrect peer dependency "react-dom@^15.0.0 || ^16.0.0".
warning " > babel-jest@21.2.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0".
warning " > enzyme@2.9.1" has incorrect peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x".
warning " > react-addons-test-utils@15.4.2" has incorrect peer dependency "react-dom@^15.4.2".
warning "react-native > eslint-plugin-react-native@3.2.1" has unmet peer dependency "eslint@^3.17.0 || ^4.0.0".
git-upgrade info Generate new version template 
git-upgrade info Add updated files to commit 
git-upgrade info Commit new version template 
git-upgrade info Generate the patch between the 2 versions 
git-upgrade info Save the patch in temp directory 
git-upgrade info Reset the 2 temporary commits 
git-upgrade info Apply the patch 
error: patch failed: .gitignore:51
Falling back to three-way merge...
Applied patch to '.gitignore' with conflicts.
error: ios/MyApp.xcodeproj/project.pbxproj: does not exist in index
error: ios/MyApp/AppDelegate.h: does not exist in index
error: ios/MyApp/AppDelegate.m: does not exist in index
error: ios/MyApp/main.m: does not exist in index
error: ios/MyAppTests/MyAppTests.m: does not exist in index
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts. 
git-upgrade info Upgrade done

请注意以下几行:

error: ios/MyApp.xcodeproj/project.pbxproj: does not exist in index
error: ios/MyApp/AppDelegate.h: does not exist in index
error: ios/MyApp/AppDelegate.m: does not exist in index
error: ios/MyApp/main.m: does not exist in index
error: ios/MyAppTests/MyAppTests.m: does not exist in index

现在这些文件都丢失了。尽管有消息称成功,但尝试react-native -v收益

react-native-cli: 2.0.1
react-native: 0.55.3

现在MyApp/ios/目录几乎缺少所有原始文件。如果我尝试react-native run-ios,我会得到xcodebuild: error: Scheme MyApp is not currently configured for the build action.任何建议都会非常有帮助。

1 个答案:

答案 0 :(得分:0)

想出来。对于那些有此问题的人,您需要做的就是删除您的android / ios文件夹并使用react-native eject,这将重新生成重建您的react-native项目所需的文件。这应该是官方反应原生升级指南IMO。