【问题标题】:React Native iOS build fail unable to resolve build fileReact Native iOS构建失败无法解析构建文件
【发布时间】:2019-12-15 15:07:21
【问题描述】:

我正在创建一个 react-native 应用程序,我在其中学习教程,并且该应用程序将不再构建。自从我添加了 Redux(我在应用程序完美运行后的第二天就这样做了),该应用程序已经无处不在。我恢复了代码,我重新安装了节点模块。我什至创建了一个新项目并带来了代码并运行npm install,但仍然没有任何效果。我什至通过 xcode 清除了构建文件,但这也无济于事。

我得到的错误是:

info Found Xcode project "rncourse_new.xcodeproj"
info Building (using "xcodebuild -project rncourse_new.xcodeproj -configuration Debug -scheme rncourse_new -destination id=E9C3D218-C3D5-4D9F-8931-0900B1C
DD86B -derivedDataPath build/rncourse_new")
.........
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app w
ith Xcode.app, by opening rncourse_new.xcodeproj. Run CLI with --verbose flag for more details.
User defaults from command line:
    IDEDerivedDataPathOverride = /Users/myusername/Desktop/SE_Things/Udemy/react-native/rncourse_new/ios/build/rncourse_new

note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: Unable to resolve build file: XCBCore.BuildFile (missingTargetProductReference("3b72bb1ebc7660513872fe9a221d33fb29fe2a87b7c65fea7a8f025b04a3b7ff"))
 (in target 'rncourse_new')


** BUILD FAILED **


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rn-course@0.1.0 ios: `react-native run-ios`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the rn-course@0.1.0 ios script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myusername/.npm/_logs/2019-08-07T23_37_29_541Z-debug.log

不知道还能去哪里,我什至问过教程的所有者,我正在等待他再次回复我(他最初告诉我重新创建项目并带来他的代码,我做了,但没有用)。

这里是我的 github 仓库的链接: https://github.com/ThatDevOpNeal/react-native 需要做的只是npm install(不要运行npm 审计修复)和npm run iosreact-native run-ios

【问题讨论】:

  • 没有代码/链接到项目很难帮助,但对于“创建一个新项目并带来代码”,请确保不要复制 ios/android 文件,因为可能有一些那里的上一个项目带来的设置。当您运行 react-native run-ios 时,它们将同步
  • @Andus 我知道代码可以正常工作,因为这是来自 Udemy 课程,所以我已经看到代码工作了。我可以将其发布到 Github 并在必要时将链接发送给您,但我认为这不是代码问题(此时我复制了讲师的代码)。是的,我没有,我复制的唯一内容是package.json**.js,仅此而已。无论讲师包括什么,然后我运行npm installreact-native run-ios
  • 既然你之前提到代码已经工作了,我猜应该是缓存/安装问题,我建议你通过watchman watch-del-all && react-native start --reset-cache清理缓存,然后去xcode清理项目,之后关闭所有内容并重建项目。
  • 另外,您可能想尝试删除 ios 文件夹中的 build 文件,它会在您运行 react-native run-ios 时重新生成一个新文件
  • 最后,这个link也可能对你有帮助

标签: ios node.js xcode react-native npm


【解决方案1】:

我刚收到这个错误信息,我尝试删除 ios/build 目录并重建,但它仍然有错误,所以我必须创建一个新项目,复制我的旧代码。并且有效。

我认为当我删除 node_modules 时,CocoaPods 模块不会安装。正是没有这个包导致了这种情况。

顺便说一句,我是中国人,我的英文不是很会。希望理解。

【讨论】:

    猜你喜欢
    • 2019-06-06
    • 2019-08-16
    • 2021-12-16
    • 2021-02-04
    • 1970-01-01
    • 1970-01-01
    • 2016-10-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多