react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Command PhaseScriptExecution failed with a nonzero exit code - Error when Archive on Xcode 14.3

Open leofolive opened this issue 1 year ago • 129 comments

Description

Hi Guys, I'm trying to perform an archive using 0.71.5 but I'm getting an error.

The error occurs in Build phase "[CP] Embed Pods Frameworks", when he runs the script with:

"${PODS_ROOT}/Target Support Files/Pods-MyApp/Pods-MyApp-frameworks.sh"

React Native Version

0.71.5

Output of npx react-native info

System: OS: macOS 13.3 CPU: (8) arm64 Apple M1 Memory: 79.22 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.1/bin/yarn npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm Watchman: 2022.11.14.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/leonardo.felipe/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0 System Images: android-32 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a Android NDK: 22.1.7171670 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.14.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.5 => 0.71.5 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  • Create a project in 0.71.5
  • Try to perform an archive
  • Archive will fail in build phase "[CP] Embed Pods Frameworks"

Snack, code example, screenshot, or link to a repository

Investigating the problem I noticed that the problem occurs in the "Symlinked..." of the script Pods-MyApp-frameworks.sh

  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi

Workaround is to update all the generated ...-frameworks.sh files to add the -f flag to the call to readlink. In other words, replace source="$(readlink "${source}")" with source="$(readlink -f "${source}")"

The Workaround above was suggested for the issue below and has now been merged into the cocoapods repository. I believe we will need an RC with this FIX pointing to the new version of cocoapods as soon as it is released.

https://github.com/CocoaPods/CocoaPods/issues/11808 https://github.com/CocoaPods/CocoaPods/pull/11828

leofolive avatar Apr 02 '23 18:04 leofolive

Having the same issue. Apple M2 Pro, Xcode 14.3.

netvalue-emursali avatar Apr 03 '23 03:04 netvalue-emursali

+1

JacobFJ avatar Apr 03 '23 05:04 JacobFJ

+1

Daha62 avatar Apr 03 '23 06:04 Daha62

Facing the same issue.

rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

Command PhaseScriptExecution failed with a nonzero exit code

UPDATE adding '-f' on the highlighted line in this file resolved my issue. You can try this

Screenshot 2023-04-13 at 9 56 22 AM

milind-betaflux avatar Apr 03 '23 07:04 milind-betaflux

duplicate of https://github.com/facebook/react-native/issues/36739

kelset avatar Apr 03 '23 09:04 kelset

@kelset I believe that although this question deals with an error in the same build phase, it seems to me that it pertains to different matters.

The patch reported in the problem you cited, does not solve my problem.

I had a very strange issue where the pods frameworks script would fail to copy the framework files when archiving a build (building worked fine).

leofolive avatar Apr 03 '23 13:04 leofolive

@kelset can you check again this error? it looks different for me from #36739

johnsoncwb avatar Apr 03 '23 13:04 johnsoncwb

re opening - but it looks like it's not a react-native problem, but cocoapods, so not really anything we can do about it https://github.com/CocoaPods/CocoaPods/pull/11828 --- I'll pass it along

kelset avatar Apr 03 '23 13:04 kelset

While trying to upgrade step by step from 0.69.1 to 0.71.5 step by step I have not gotten fastlane to build the latest week. iOS simulator runs fine.

I have applied the target deployment version patch and set my Gemfile for

gem 'cocoapods', git: 'https://github.com/CocoaPods/CocoaPods.git', branch: 'master'

which resolves to https://github.com/CocoaPods/CocoaPods/commit/3ac99beed81d11a830bdce2fac761a49bae47e83.

Given these changes a clean out and pod-reinstall I'm still seeing symlink issues after running this darling command:

rm -rf ~/Library/Developer/Xcode/DerivedData/ && pod cache clean --all && rm -rf build && cd .. && rm -rf node_modules && npm i && cd ios && pod install; bundle exec fastlane beta config:staging

from the ios folder.

The log output from fastlane is saying:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/stefanwallin/Library/Developer/Xcode/DerivedData/app_name-dndxchzknwcsfobnpspeueibkplb/Build/Intermediates.noindex/ArchiveIntermediates/app_name/IntermediateBuildFilesPath/app_name.build/Release-iphoneos/app_name.build/Script-01409BA429EB16AADA33A048.sh (in target 'app_name' from project 'app_name')
    cd /Users/stefanwallin/iteam/app_name_app/app/ios
    /bin/sh -c /Users/stefanwallin/Library/Developer/Xcode/DerivedData/app_name-dndxchzknwcsfobnpspeueibkplb/Build/Intermediates.noindex/ArchiveIntermediates/app_name/IntermediateBuildFilesPath/app_name.build/Release-iphoneos/app_name.build/Script-01409BA429EB16AADA33A048.sh
mkdir -p /Users/stefanwallin/Library/Developer/Xcode/DerivedData/app_name-dndxchzknwcsfobnpspeueibkplb/Build/Intermediates.noindex/ArchiveIntermediates/app_name/BuildProductsPath/Release-iphoneos/app_name.app/Frameworks
Symlinked...
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/DoubleConversion.framework" "/Users/stefanwallin/Library/Developer/Xcode/DerivedData/app_name-dndxchzknwcsfobnpspeueibkplb/Build/Intermediates.noindex/ArchiveIntermediates/app_name/InstallationBuildProductsLocation/Applications/app_name.app/Frameworks"
building file list ... rsync: link_stat "/Users/stefanwallin/iteam/app_name_app/app/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/DoubleConversion.framework" failed: No such file or directory (2)

Which to me clearly indicates a still present symlink issue. Are we still convinced this is a cocoapods-issue or how RN uses cocoapods or the script? I'm happy to move this issue to the cocoapods-repo but it seems to me it might be due to some internal use in DoubleConversion?

Also, cocoapods does not accept issues with RN/Flutter, as per their new issue template. I am not sure where to start to make this a reproducible issue without RN.

WARNING: Please do not file issues for CocoaPods with projects 
that use React Native or Flutter. Please remove React Native or Flutter
in your sample app in order to properly demonstrate an issue with CocoaPods itself.

The integration between CocoaPods and React Native or Flutter 
makes it very difficult for us to diagnose and fix issues.

Issues with React Native or Flutter will be closed.

StefanWallin avatar Apr 03 '23 15:04 StefanWallin

Same issue using flutter

salamohamad avatar Apr 03 '23 15:04 salamohamad

I am also facing the same issue, after updating to the lates XCode V14.3

OrbitalTech avatar Apr 04 '23 10:04 OrbitalTech

Also having the same issue when i try to archive my App. After updated Xcode to V14.3

cegonzal1991 avatar Apr 04 '23 11:04 cegonzal1991

Yes, same issue here after upgrading to Xcode 14.3. Cocoapods is broken in this release. Anyone been able to resolve?

dacowles avatar Apr 04 '23 13:04 dacowles

@dacowles I've done as described here and it solved my issue

alroniks avatar Apr 04 '23 14:04 alroniks

Same issue. React Native 0.65. The following build commands failed: CompileC /{path}/mobile/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Yoga' from project 'Pods') (1 failure)

maks1mp avatar Apr 06 '23 18:04 maks1mp

check for spaces as you are naming the project folders. Use space alternatives.

ianmgithua avatar Apr 11 '23 19:04 ianmgithua

This help me to fix the issue. https://developer.apple.com/forums/thread/725230 Please have a look, may be this will help..!

rovin01 avatar Apr 13 '23 04:04 rovin01

For everyone still having this issue, I recommend to follow the instructions in this link and add a post install script for now.

danidaryaweesh avatar Apr 14 '23 22:04 danidaryaweesh

Hi, anyone are experience these issue?

Processing Info.plist

▸ Running script ‘[CP] Embed Pods Frameworks’

▸ Generating ‘App.app.dSYM’

** ARCHIVE FAILED **

The following build commands failed:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/runner/Library/Developer/Xcode/DerivedData/App-azlyibamtvkrbhfwntgmcwffjqtw/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target ‘App’ from project ‘App’)

(1 failure)

RenzoPH avatar Apr 29 '23 08:04 RenzoPH

@RenzoPH have you tried updating cocoapods to version 1.12.1? Updating to the mentioned version solved all my issues

danidaryaweesh avatar Apr 30 '23 11:04 danidaryaweesh

Fixed this by updating updating node_modules/react-native/scripts/find-node.sh @ L7

- set -e
+ set +e

P.S. Tried switching node from nvm to brew but that didn't made any difference.

pranshuchittora avatar May 05 '23 08:05 pranshuchittora

@RenzoPH have you tried updating cocoapods to version 1.12.1? Updating to the mentioned version solved all my issues

Thanks! Worked for me!

Yohanson555 avatar May 05 '23 11:05 Yohanson555

Fixed this by updating updating node_modules/react-native/scripts/find-node.sh @ L7

- set -e
+ set +e

P.S. Tried switching node from nvm to brew but that didn't made any difference.

God, you saved me!!!!!!!!

margox avatar May 05 '23 13:05 margox

I don't have Pods-App-frameworks.sh in my ios project, I am using 0.61.5. Can't update project due to some dependencies.

Please guide

aurangs7 avatar May 09 '23 08:05 aurangs7

@aurangs7 Have you tried following the instructions here ?

danidaryaweesh avatar May 09 '23 10:05 danidaryaweesh

Yes @danidaryaweesh I tried that post_install hook, but I got errors on the pod install.

my versions: react-native 0.61.5 cocoa pod 1.12.1

aurangs7 avatar May 09 '23 11:05 aurangs7

Fixed this by updating updating node_modules/react-native/scripts/find-node.sh @ L7

- set -e
+ set +e

P.S. Tried switching node from nvm to brew but that didn't made any difference.

God, you saved me!!!!!!!!

Tried ^^ this fix, I was not able to find find-node.sh file, but I searched 'set -e' on'ios-configure-glog.sh' file The build was success but app is crashing on launch.

Yes @danidaryaweesh I tried that post_install hook, but I got errors on the pod install.

my versions: react-native 0.61.5 cocoa pod 1.12.1

aurangs7 avatar May 09 '23 11:05 aurangs7

I did this "Move the project folder in a path with no spaces (i.e. ~/sub folder name/ReactNativeApp won't work till you have spaces in the path, so move in a path like ~/folder/ReactNativeApp)" and then deleted and re-created the project

undeath55 avatar May 13 '23 16:05 undeath55

Hi everyone, I already fixed the issue that I encounter, I tried to upgrade our xCode version to 14.+ and also the macOS-12 to our pipeline.

RenzoPH avatar May 14 '23 14:05 RenzoPH

Fixed this by updating updating node_modules/react-native/scripts/find-node.sh @ L7

- set -e
+ set +e

P.S. Tried switching node from nvm to brew but that didn't made any difference.

THANKSSS this is working for me!!

Xcode: 14.2 Cocoapod: 1.12.1

NoahSimajji avatar May 29 '23 06:05 NoahSimajji