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

Command 'pod install' failed (head -n 1)

Open globuxt opened this issue 2 months ago β€’ 3 comments

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Got error "⚠️ Something went wrong running pod installin theiosdirectory."

Below is the error:

Command 'pod install' failed.
└─ Cause: /bin/bash -c 
set -e
CURRENT_PATH=$(pwd)
mkdir -p Headers
XCFRAMEWORK_PATH=$(find "$CURRENT_PATH" -type d -name "ReactNativeDependencies.xcframework")
HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | head -n 1)

# Check if XCFRAMEWORK_PATH is empty
if [ -z "$XCFRAMEWORK_PATH" ]; then
  echo "ERROR: XCFRAMEWORK_PATH is empty."
  exit 0
fi

# Check if HEADERS_PATH is empty
if [ -z "$HEADERS_PATH" ]; then
  echo "ERROR: HEADERS_PATH is empty."
  exit 0
fi

cp -R "$HEADERS_PATH/." Headers
mkdir -p framework/packages/react-native
cp -R "$XCFRAMEWORK_PATH/../." framework/packages/react-native/
find "$XCFRAMEWORK_PATH/.." -type f -exec rm {} +
find "$CURRENT_PATH" -type d -empty -delete

Unknown option: n
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output


pod install --repo-update --ansi exited with non-zero code: 1

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec b/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec
index e08e6c2..0a63709 100644
--- a/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec
+++ b/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec
@@ -44,11 +44,12 @@ Pod::Spec.new do |spec|
 
   # We need to make sure that the headers are copied to the right place - local tar.gz has a different structure
   # than the one from the maven repo
+  #    HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | head -n 1)
   spec.prepare_command    = <<-CMD
     CURRENT_PATH=$(pwd)
     mkdir -p Headers
     XCFRAMEWORK_PATH=$(find "$CURRENT_PATH" -type d -name "ReactNativeDependencies.xcframework")
-    HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | head -n 1)
+    HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | /usr/bin/head -n 1)
 
     # Check if XCFRAMEWORK_PATH is empty
     if [ -z "$XCFRAMEWORK_PATH" ]; then

This issue body was partially generated by patch-package.

globuxt avatar Nov 13 '25 18:11 globuxt

[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


You can read more about about it on our website: How to report a bug.

react-native-bot avatar Nov 13 '25 18:11 react-native-bot

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Got error "⚠️ Something went wrong running pod installin theiosdirectory."

Below is the error:

Command 'pod install' failed. └─ Cause: /bin/bash -c set -e CURRENT_PATH=$(pwd) mkdir -p Headers XCFRAMEWORK_PATH=$(find "$CURRENT_PATH" -type d -name "ReactNativeDependencies.xcframework") HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | head -n 1)

Check if XCFRAMEWORK_PATH is empty

if [ -z "$XCFRAMEWORK_PATH" ]; then echo "ERROR: XCFRAMEWORK_PATH is empty." exit 0 fi

Check if HEADERS_PATH is empty

if [ -z "$HEADERS_PATH" ]; then echo "ERROR: HEADERS_PATH is empty." exit 0 fi

cp -R "$HEADERS_PATH/." Headers mkdir -p framework/packages/react-native cp -R "$XCFRAMEWORK_PATH/../." framework/packages/react-native/ find "$XCFRAMEWORK_PATH/.." -type f -exec rm {} + find "$CURRENT_PATH" -type d -empty -delete

Unknown option: n Usage: head [-options] ... -m use method for the request (default is 'HEAD') -f make request even if head believes method is illegal -b Use the specified URL as base -t Set timeout value -i

send this HTTP header (you can specify several)

-u            Display method and URL before any response
-U            Display request headers (implies -u)
-s            Display response status code
-S            Display response status chain
-e            Display response headers
-d            Do not display content
-o <format>   Process HTML content in various ways

-v            Show program version
-h            Print this message

-x            Extra debugging output

pod install --repo-update --ansi exited with non-zero code: 1 Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec b/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec index e08e6c2..0a63709 100644 --- a/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec +++ b/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec @@ -44,11 +44,12 @@ Pod::Spec.new do |spec|

We need to make sure that the headers are copied to the right place - local tar.gz has a different structure

than the one from the maven repo

  • HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | head -n 1)

    spec.prepare_command = <<-CMD CURRENT_PATH=$(pwd) mkdir -p Headers XCFRAMEWORK_PATH=$(find "$CURRENT_PATH" -type d -name "ReactNativeDependencies.xcframework")
  • HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | head -n 1)
  • HEADERS_PATH=$(find "$XCFRAMEWORK_PATH" -type d -name "Headers" | /usr/bin/head -n 1)

    Check if XCFRAMEWORK_PATH is empty

    if [ -z "$XCFRAMEWORK_PATH" ]; then This issue body was partially generated by patch-package.

Steps i took: Step 1: npm install patch-package postinstall-postinstall --save-dev

Step 2: Add "postinstall": "patch-package" to "scripts" in package.json "scripts": { "postinstall": "patch-package" } Step 3: npx patch-package react-native

Step 4 cd ios pod deintegrate

Note: This error occurred on a React Native (Expo Project)

globuxt avatar Nov 13 '25 19:11 globuxt

This really fixed my problem on macOS.

IamBennySwag avatar Dec 16 '25 00:12 IamBennySwag