React Native 0.64 Command PhaseScriptExecution failed with a nonzero exit code - ios

I'm installing a new project with a bunch of modules with React Native 0.64. I can do a pod install without troubles, but when I want to make my app running (with react-native run-ios or with XCode) this error occured on XCode :
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: readlink: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: dirname: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: cd: : No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
This one on react-native run-ios :
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/thomas/Library/Developer/Xcode/DerivedData/appname-aqbmfgqjkshyqmaprdvggqaeqjrp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/**FBReactNativeSpec**.build/Script-A319AA7F2B7AAE771AE63D66A0049241.sh
Note that I don't have a 'scripts' folder in my node_modules/react-native (I just have assets, normalize-color and polyfills folders). I've tried to remove node-modules and reinstall it.
My specs are :
iOS Big Sur v. 11.2.3
XCode v.12.3
React Native v.0.64
CocoaPods v. 1.10.1
Node v. 12.14.1
Any help ? Thanks.

I found the solution after hours of debugging you need to modify this file for now.
Edit this file /node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh
Add this line export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
Then run the project using Xcode it will work 100%

The above answer is correct but in that case, you are editing the inside the node modules. So rather than just enter this command in your terminal
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

Related

Xcode script - xargs: python: No such file or directory - Command PhaseScriptExecution failed with a nonzero exit code

After updating to Xcode 13.3.1 and updating comand line tools I cannot build my project. I get error:
Command PhaseScriptExecution failed with a nonzero exit code
python -mjson.tool ./someFileName.json
xargs: python: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
The script that failes is:
python -mjson.tool "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/assets/someFileName.json"
It was working fine before. Even if I checkout at the commit that was working I still get the same message. This is why I suspect Xcode update.
Does anyone know how to solve this? What does the error mean? What does No such file or directory refer to? Is Python missing (cannot be found)? what is mjson.tool and is it missing? Is someFileName.json missing?
Any help is appreciated :)
Let me answer my own question here :)
MacOS 12.3.1 Monterey dropped support for Python 2 and it is removed from the OS. That is what
xargs: python: No such file or directory
was trying to say to me - python is missing. Fortunately Python 3 is installed and you can access it by calling python3 instead of just python.
Be ware because python2 code is not always runnable on Python3. Chances are you will need to fix (update) the code.
I was lucky and I managed to fix this just by replacing python with python3.
Alternatively you could try to install python2 by hand but this is not recommended.

Error after installing the SPM package of Realm/SwiftLint: no such file or directory

So I'm needing to install SwiftLint for a project and I installed it as an SPM package from their repo here: https://github.com/realm/SwiftLint.
Shortly after installing it, I go to build the project and get this error:
/Users/MyUser/Library/Developer/Xcode/DerivedData/Project-caihxbhbecuvjfdnnwkmygqurxhn/Build/Intermediates.noindex/Project.build/Debug-iphonesimulator/Project.build/Script-89127C271F8EAAD2009335C8.sh: line 2: /SwiftLint/swiftlint: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
I'm not very experienced with Packages so this is all new to me but I can't seem to find any documentation on this particular error, or if there is something else I'm missing in the installation. I've tried removing and reinstalling the package, deleting DerivedData and cleaning the build in every combination/order you can think of. Currently running Xcode 13.2.1 and a target of iOS 14.1.

Getting PhasescriptExecution Error in Xcode 13.0

I am getting Error while running Project:
file:///Users/AVC/Documents/Simon%20Projects/DemoApp/bin/xcodeproj-checker-config-permissive.yml
ln: /Users/AVC/Documents/Simon Projects/DemoApp/.git/hooks/pre-commit: File exists
Command PhaseScriptExecution failed with a nonzero exit code
My XCode Version: 13.0
Swift Vdersion: 4.2
Tried lot of ways But cant find solution.
Remove .git/hooks/pre-commit
That is just a alias and the original file can not be created due to this. script creates new pre-commit file and it's alias at run time.

Command PhaseScriptExecution failed with a nonzero exit code: bin/xcode_backend.sh: No such file or directory

I'm making an app on flutter, but for some reason when i try to build my app and run it on my device i'm getting this error below.
/bin/sh: /Users/maps/Desktop/flutter/bin/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
I tried to:
Update sdk path because i transfer the project from a windows PC to my macbook
Cleaning and re-building the project
Deleting Pods folder and podfile.lock file and running pod install again
But none of these solutions worked for me.
Note: I'm beginner on Flutter development :-)

Command PhaseScriptExecution failed with a nonzero exit code flutter

I got an error when I tried to add flutter to an existing iOS app it worked fine on the android side, in IOS I got this error message :
/Users/mac/Library/Developer/Xcode/DerivedData/Fixit- dffmmspbqmueppghdvveloietubr/Build/Intermediates.noindex/Fixit.build/Debug- iphoneos/Fixit.build/Script-04B0EA9A232E6ABD008A0448.sh: line 3: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
/Users/mac/Library/Developer/Xcode/DerivedData/Fixit- dffmmspbqmueppghdvveloietubr/Build/Intermediates.noindex/Fixit.build/Debug- iphoneos/Fixit.build/Script-04B0EA9A232E6ABD008A0448.sh: line 4: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
inside my pod file i added this inside target application:
flutter_application_path = '⁨Users⁩/mac⁩/FixitApps⁩/customerApp⁩/fixit_flutter_customer_app/'
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
I followed this tutorial: https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
if you create a script file in the build phase for building dart code remove it and add this to your podfile :
flutter_application_path = '⁨Users⁩/mac⁩/FixitApps⁩/customerApp⁩/fixit_flutter_customer_app/'
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
install_all_flutter_pods(flutter_application_path)
In my case when I have deleted some files from assets but forget to remove from pubspes.yaml.
Error solved after
remove deleted files from pubspes.yaml
click on pub get.
run on device
I am using a cloud virtual computer to build my iOS apps, in that case when I'm building the app, the machine got disconnected after I connect it again this above error popped up. But after I turn off the machine and restarted it, this error did not pop up.

Resources