PhaseScriptExecution error in React Native app - ios

Facing this error when I run react-native run-ios after creating the project
Error -
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)
Steps followed-
yarn install
start metro server
cd ios -> pod install
npx react-native run-ios
Pretty new to react native so I am totally clueless why this is happening. It would be much appreciated if someone can help with this.
If you have faced the same issue and still clueless like me then please share and upvote so it reaches to as many people as possible.

I have figured out a solution, if you're using nvm make sure you don't have another globally installed version of Node/npm.
If you aren't sure whether or not you have a global version, go to your bash_profile/zshrc and comment the three nvm initialization lines (export NVM_DIR="$HOME/.nvm" [...]), then open a new terminal and do node --version, if it still finds something it means that you have a global version somewhere, and you can find its path with which node.
In my case I'm using Homebrew, and I had a global version of Node that I wasn't even aware coming from the yarn formula, I discovered it after running brew uses --installed node. I went ahead and uninstalled yarn using brew uninstall --force yarn, which automatically uninstalled its node/npm dependency, then uncommented the nvm initialization lines, and then I reinstalled yarn using nvm's npm with npm i -g yarn, and now everything works.

The only solution that worked for me currently (RN v0.64.0), till this issue root cause properly identified (seems related to nvm though!) is to go to your /node_modules/react-native/scripts/find-node.sh and set these two lines on top.
You can use patch-package to keep those changes permanent.
unset npm_config_prefix
unset PREFIX

I was facing the same error, and I've just run the command suggested in the error:
$ unset PREFIX.
Afterwards the app was building properly.

On Mac, using these two steps, I resolved the issue.
I have removed the old ~/.nvm folder. from-comment
Then I have created via command ln -s $(which node) /usr/local/bin/node (from-answer)

Got same error. Tried lots of fixes, but nothing helped.
I fixed this problem by creating new user on my mac. IOS app began building again in Xcode. I will make some more research what was the reason. I guess its because of bad development environmet setup.

If you explicitly know what version of node you want to run, there's a way to inject it without patch-package (or, one rabbit-hole I went down, sed). The find-node.sh script is actually just updating the PATHs that node is looked for, where generate-specs.sh is actually looking for the node binary...but it allows you to override that with the NODE_BINARY environment variable.
So you could NODE_BINARY=/usr/local/bin/mynode npx react-native run-ios

I had the same issue, the fastest way for it to work (due to some professional issues) was to completely remove NVM and installing Node through brew (macOS)

React Native 0.64 uses the new codegen part and this does not work correctly (yet) when there are spaces in the path of the project. It's a know bug and will be solved in future version, PR already is made
For now you could use a path without a space in it.
Works
/home/wbroek/projectname/
Does not work
/home/wbroek/project name/

It´s a bit of a hack but try this in your podfile:
Ref
post_install do |installer|
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end

I have also faced a similar type of issue. I have find solution on react native github repo.
Removing
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion from ~/.bash_profile .
AND
Commenting out all the code from project/node_modules/react-native/scripts/find-node.sh
helped to solve this issue.
You can also check original
https://github.com/facebook/react-native/issues/31249#issuecomment-811715288

I had this problem while my which node was pointing to /usr/local/bin/node
Solved it by
Installing nvm from curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm use 16
cd ios/ Delete podfile.lock and Pods/
pod instal

I had a same problem and could solve it as following steps.
{your project} > ios > Podfile
Change from "false" to "true" at the "hermes_enabled" setting.
:hermes_enabled => true
cd ios && pod install
npx react-native run-ios

I solved this problem using npx react-native run-ios instead of yarn ios.
Maybe can help u .

Yeah, had the same issue, didn't realize it was a new RN version first. Downgraded to 0.63.4 and it works as it should:
yarn upgrade react-native#0.63

Related

CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'Pageboy' from project 'Pods')

I am getting the below error when I build my iOS project in Xcode 13.0 for Simulator 15 with Swift 5.5
Issue related to your's dependencies: You must have to wait for those dependencies to update to Swift 5.5, otherwise, you have to stay on Xcode 12. In my case, I updated to 13 during development.
For Example:
The following build commands failed:
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'ExpoModulesCore' from project 'Pods')
The outdated pod here seems to be ExpoModulesCore
and if it does not work, like it did not for me lol:
follow this: https://stackoverflow.com/a/69384358/15421728
For anyone looking for an answer.
run
cd ios
pod update ExpoModulesCore
and repeat the previous step for every outdated pod, if there are more outdated.
I am working with react native and had a very similar error.
This worked for me:
cd ios && rm -rf Pods && pod cache clean --all && pod install && cd ..
For me it helped to downgrade XCode. I got back from 13.3 to 13.2.
You can get previous versions this way:
https://stackoverflow.com/a/7047804/7405518
Getting back to version 13.3 caused same problems again.
I got this as well, but I just had to add my package again yarn add ... so it autolinked correctly with react-native

error: could not build Objective-C module 'agora_rtc_engine'

Following up on the repo https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart
Unable to build the project on macOS with the following spec
Flutter 2.2.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d79295af24 (10 days ago) • 2021-06-11 08:56:01 -0700
Engine • revision 91c9fc8fe0
Tools • Dart 2.13.3
Here is the full error stack
/.../.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-3.3.3/ios/Classes/Base/AgoraRtcEngineKit.h:9:9: error: 'AgoraRtcKit/AgoraRtcEngineKit.h' file not found
#import <AgoraRtcKit/AgoraRtcEngineKit.h>
^
<unknown>:0: error: could not build Objective-C module 'agora_rtc_engine'
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
/.../Agora-Flutter-Quickstart/ios/Pods/Pods.xcodeproj: 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.5.99. (in target
'AgoraRtcEngine_iOS' from project 'Pods')
/.../Agora-Flutter-Quickstart/ios/Pods/Pods.xcodeproj: 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.5.99. (in target 'Flutter'
from project 'Pods')
I"m not sure if this solution works for others, but this is what worked for me
In here https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart/blob/master/pubspec.yaml#L21:L23
Changed Agora RTC engine version and permission handler to
agora_rtc_engine: ^4.0.1
permission_handler: ^6.0.1
And do the following
Remove ios/Podfile.lock
Remove Pods folder
cd ios > pod install or pod install --repo-update
Remove pubspec.lock
Remove build folder
Run flutter pub get
If this still does not work
rm -rf /YourUserPath/.pub-cache
rm -rf ~/Library/Developer/Xcode/DerivedData
rm ios/Podfile
rm ios/Podfile.lock
rm pubspec.lock
rm -rf ios/Pods
rm -rf ios/Runner.xcworkspace
flutter clean
flutter build ios
flutter clean
flutter run
Try this solution according this:
Quit Xcode.
Delete project's temp files located at
~/Library/Developer/Xcode/DerivedData
Delete ProjectName.xcworkspace
Delete Podfile.lock file and Pods folder
Run pod install.
Open the newly created ProjectName.xcworkspace file and build.

Flutter AMSupportURLConnectionDelegate is implemented in both ?? Error

I am facing many issues since I migrated my project to an Apple Silicon mac. I finally managed to reduce the problems but not sure the answer to this.
Running "flutter pub get" in Flutter_the app copy 3... 760ms
Launching lib/main.dart on iPhone 11 in debug mode...
Running pod install... 986ms
Running Xcode build...
Xcode build done. 1.5s
Failed to build iOS app
Error output from Xcode build:
↳
objc[95181]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x20ba238f0) and ??
(0x1160dc2b8). One of the two will be used. Which one is undefined.
objc[95181]: Class AMSupportURLSession is implemented in both ?? (0x20ba23940) and ?? (0x1160dc308). One
of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
warning: Unable to read contents of XCFileList '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project
'Runner')
error: Unable to load contents of file list: '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-input-files.xcfilelist' (in target 'Runner' from project
'Runner')
error: Unable to load contents of file list: '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project
'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 11.
Is there any way to solve this. I am not sure if the problem is even written in there.
I was getting this error
Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib
NOTE:
Try this first if you have updated to flutter 2.10 from <=2.8
flutter pub upgrade
Solution:
Please open podfile and update with this script
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
flutter clean
flutter pub get
cd ios
pod install
or instead of last command you can try below for M1
arch -x86_64 pod install // for M1
Run your app.
I was getting the same "error output from Xcode build" with my M1 macbook recently as well after updating to Flutter 2.x.
I was able to clear this issue on mine by doing the following:
Change directory to your project's path and sub-directory:
your_project/build/ios/Debug-iphonesimulator/
Run $ xattr -lr Runner.app
Run $ xattr -cr Runner.app
Apparently flutter projects have extended attributes in project app bundles containing Finder info which causes an error.
I found these links that helped for reference.
https://developer.apple.com/library/archive/qa/qa1940/_index.html
https://github.com/flutter/flutter/issues/72492
Try Selecting For install builds only in the run script in the Build phases tab.
Two things need to change:
First check the Dependancy for APNs if need to upgrade. Then Change the version in the POD file and then add
pod 'GoogleUtilities'
To the POD target like following:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(FILE))
pod 'GoogleUtilities'
end
.
After this Run Flutter pug get and Flutter run. It works for me.
Ref screenshot for POD file

Build errors with XCode 12

Looks like Cocoapods and XCode12 are throwing lot of issues that are difficult to manage. In XCode12, it prompted me to perform a settings update of project to update deployment target of all pods to iOS 12 and I did it. But immediately after updating settings, I get these errors in nanopb-umbrella.h:
There are also pod warnings such as:
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.
I thought upgrading project settings that updates deployment target of each pod to iOS 12.0 will fix it but instead it causes build errors. Pod update doesn't help either. Neither does pod deintegrate and reinstall along with removing DerivedData.
A fix is at CocoaPods/CocoaPods#9905 and targeted for CocoaPods 1.10. As a (temporary) workaround you can set "Quoted include in framework headers" in pods project build settings to NO.

Flutter package vibrate 0.0.4 is not working in iOS

Trying to add vibration on button click in flutter, it works fine for Android. But in iOS it fails to compile with below error
GeneratedPluginRegistrant.m:6:9: fatal error: 'vibrate/VibratePlugin.h' file not found
I am following the exact steps as stated here.
https://pub.dartlang.org/packages/vibrate#-installing-tab-
Here is the Xcode Build output:
Launching lib/main.dart on ###'s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: #####
Running pod install...
Running Xcode build...
Xcode build done. 13.1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
The use of Swift 3 #objc inference in Swift 4 mode is deprecated. Please address deprecated #objc inference warnings, test your code with “Use of deprecated Swift 3 #objc inference” logging enabled, and then disable inference by changing the "Swift 3 #objc Inference" build setting to "Default" for the "Runner" target.
The use of Swift 3 #objc inference in Swift 4 mode is deprecated. Please address deprecated #objc inference warnings, test your code with “Use of deprecated Swift 3 #objc inference” logging enabled, and then disable inference by changing the "Swift 3 #objc Inference" build setting to "Default" for the "Runner" target.
/Users/####/Flutter_Projects/project_####l/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'vibrate/VibratePlugin.h' file not found
#import <vibrate/VibratePlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the precompiled application for the device.
I hit this same issue when building my flutter app for iOS and found this link that solved it for me.
https://github.com/benjamindean/flutter_vibration/issues/1
The answer I believe is to edit your .../appname/ios/Podfile
Go to the section that says:
target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
and add the "use_frameworks!" right under the "target 'Runner' do" like this:
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
Try adding the below line in pod file under project>iOS>podfile under target 'Runner' doenter image description here
use_frameworks! :linkage => :static

Resources