ReactNative应用程序中的PhaseScriptExecution错误

创建项目后运行 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)

步骤如下——

  1. 纱线安装
  2. 启动地铁服务器
  3. cd ios -> pod 安装
  4. npx react-native run-ios

对原生反应很新,所以我完全不知道为什么会发生这种情况。如果有人可以帮助解决这个问题,我们将不胜感激。

如果您遇到了同样的问题,但仍然像我一样一无所知,那么请分享和点赞,以便尽可能多地了解它。

回答

我想出了一个解决方案,如果您正在使用,请nvm确保您没有另一个全局安装的 Node/npm 版本

如果您不确定您是否有全局版本,请转到您的 bash_profile/zshrc 并注释三个nvm初始化行 ( export NVM_DIR="$HOME/.nvm" [...]),然后打开一个新终端并执行node --version,如果它仍然找到某些内容,则表示您有一个全局版本某个地方的版本,你可以找到它的路径which node

就我而言,我使用的是 Homebrew,我有一个全局版本的 Node,我什至不知道来自yarn公式,我在运行brew uses --installed node. 我继续使用 卸载了yarn brew uninstall --force yarn,它会自动卸载其节点/npm 依赖项,然后取消注释nvm初始化行,然后我yarn使用 nvm 的 npm with重新安装npm i -g yarn,现在一切正常。

  • you saved me few hours there!

回答

我遇到了同样的错误,我刚刚运行了错误中建议的命令:

$ 取消设置前缀。

之后,该应用程序正在正确构建。

  • Hi Cata, this pointed me in the right direction. It didn’t run with just the unset but it did when I removed an old ~/.nvm folder (I used nvm previously). Now its working as expected. Thanks!

回答

目前对我有用的唯一解决方案(RN v0.64.0),直到正确确定此问题的根本原因(尽管似乎与 nvm 有关!)是转到您的/node_modules/react-native/scripts/find-node.sh并将这两行设置在顶部。

您可以使用patch-package这些更改来永久保留这些更改。

unset npm_config_prefix
unset PREFIX


以上是ReactNative应用程序中的PhaseScriptExecution错误的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>