Skip to content

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

@globuxt

Description

@globuxt

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 react-native@0.81.5 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions