I’ve been trying to figure out why this xcode cloud custom scripts suddenly started failing on me yesterday since I haven’t changed anything and it was working before:
#!/bin/sh
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
brew install cocoapods
# have to add node yourself
brew install node@16
# link it to the path
brew link node@16
brew install yarn
# Install dependencies you manage with CocoaPods.
yarn
pod install
# the sed command from RN cant find the file... so we have to run it ourselves
sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' /Volumes/workspace/repository/ios/Pods/RCT-Folly/folly/portability/Time.h
For some reason it has started failing with the following errors:
==> Installing node@16 dependency: brotli
==> Pouring brotli--1.0.9.monterey.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/brotli
/usr/local/include is not writable.
You can try again using:
brew link brotli
Then it keeps giving me same errors that it could not link for a few other dependencies.
When it tries to run yarn
I get this:
yarn requires a Node installation to function. You can install one with:
brew install node
Assuming the node installation didn’t work successfully.
Then finally this:
[in /Volumes/workspace/repository/ios]
[!] Invalid `Podfile` file: cannot load such file -- /Volumes/workspace/repository/node_modules/react-native/scripts/react_native_pods.
# from /Volumes/workspace/repository/ios/Podfile:1
# -------------------------------------------
> require_relative '../node_modules/react-native/scripts/react_native_pods'
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# -------------------------------------------
sed: /Volumes/workspace/repository/ios/Pods/RCT-Folly/folly/portability/Time.h: No such file or directory
EDIT
Seems like I’m not the only one experiencing this:
https://developer.apple.com/forums/thread/712550
It seems to be an issue with the platform and not by my config apparently.
2
Answers
Changing the macOS version (in Workflow environment settings) from "Latest release" to 12.4 could help.
I managed to find a workaround by installing node from the .tar.gz from node website:
also: If you need node to build a react native app you need to generate
ios/.xcode.env.local
so it exports$NODE_BINARY
:Good luck!