在创建项目后运行 react-native run-ios 时遇到此错误
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 with Xcode.app, by opening BoltAssignment.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace BoltAssignment.xcworkspace -configuration Debug -scheme BoltAssignment -destination id=3E598855-6D4F-4F36-BEE1-8663A1F71787
nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
Run `unset PREFIX` to unset it.
nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
Run `unset PREFIX` to unset it.
Command PhaseScriptExecution failed with a nonzero exit code
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-Glog' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.4, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-PeerTalk' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'libwebp' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'YogaKit' from project 'Pods')
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the BoltAssignment editor. (in target 'BoltAssignment' from project 'BoltAssignment')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-DoubleConversion' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'boost-for-react-native' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'RNFastImage' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'SDWebImageWebPCoder' from project 'Pods')
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/harsh_nagalla/Library/Developer/Xcode/DerivedData/BoltAssignment-cxeqsscopunscndrzxcrfnugkasb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-1F0D93C9412E4439D9C46216EB143B15.sh
(1 failure)
遵循的步骤-
对原生反应很新,所以我完全不知道为什么会发生这种情况。如果有人能提供帮助,我们将不胜感激。
如果您遇到了同样的问题,但仍然像我一样一无所知,那么请分享和点赞,以便尽可能多的人参与。
答案 0 :(得分:11)
我想出了一个解决方案,如果您使用的是 nvm
,请确保您没有安装其他全局安装的 Node/npm 版本。
如果您不确定是否有全球版本,请转到您的 bash_profile/zshrc 并注释三个 nvm
初始化行 (export NVM_DIR="$HOME/.nvm" [...]
),然后打开一个新终端并执行node --version
,如果它仍然找到某些东西,则意味着您在某处有一个全局版本,您可以使用 which node
找到它的路径。
就我而言,我使用的是 Homebrew,我有一个全球版本的 Node,我什至不知道来自 yarn
公式,我在运行 brew uses --installed node
后发现了它。我继续使用 brew uninstall --force yarn
卸载了 yarn,它自动卸载了它的 node/npm 依赖项,然后取消了 nvm
初始化行的注释,然后我使用 nvm 的 npm 和 {{1} 重新安装了 yarn
},现在一切正常。
答案 1 :(得分:7)
我遇到了同样的错误,我刚刚运行了错误中建议的命令:
$ 取消设置前缀。
之后,该应用程序正常构建。
答案 2 :(得分:6)
目前对我有用的唯一解决方案 (RN v0.64.0),直到正确确定此问题的根本原因(尽管似乎与 nvm 相关!)是转到您的 /node_modules/react-native/scripts/find-node.sh
并将这两行设置在顶部.
您可以使用 patch-package
将这些更改永久保存。
unset npm_config_prefix
unset PREFIX
答案 3 :(得分:3)
在 Mac 上,通过这两个步骤,我解决了问题。
ln -s $(which node) /usr/local/bin/node
(from-answer)答案 4 :(得分:1)
遇到同样的错误。尝试了很多修复,但没有任何帮助。 我通过在我的 mac 上创建新用户来解决这个问题。 IOS 应用程序开始在 Xcode 中再次构建。我会做更多的研究是什么原因。我猜是因为糟糕的开发环境设置。
答案 5 :(得分:1)
我遇到了同样的问题,最快的工作方式(由于一些专业问题)是完全删除 NVM 并通过 brew (macOS) 安装 Node
答案 6 :(得分:0)
React Native 0.64 使用了新的代码生成部分,当项目路径中有空格时,这(还)无法正常工作。这是一个know bug,将在未来版本中解决,PR already is made
现在你可以使用没有空格的路径。
作品
/home/wbroek/projectname/
不起作用
/home/wbroek/project name/
答案 7 :(得分:-1)
我遇到了同样的问题,可以按照以下步骤解决。
在“hermes_enabled”设置中从“false”更改为“true”。
:hermes_enabled => true
cd ios && pod install
npx react-native run-ios
答案 8 :(得分:-1)
我使用 npx react-native run-ios
而不是 yarn ios
解决了这个问题。
也许可以帮助你。
答案 9 :(得分:-3)
是的,有同样的问题,首先没有意识到这是一个新的 RN 版本。降级到 0.63.4,它可以正常工作:
yarn upgrade react-native@0.63