React-native: Installation with cocoapods fails on "Error installing boost: tar: Unrecognized archive format"

Created on 19 Jan 2018  路  4Comments  路  Source: facebook/react-native

Is this a bug report?

YES

Have you read the Contributing Guidelines?

YES

(A reproducible demo is attached below)

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Cocoapods: 1.3.1

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0

Target Platform: iOS (10.3)

Steps to Reproduce

  1. Create a new iOS-Project with XCode (it doesn't matter here if Objective-C is used or Swift)
  2. Restructure the directory structure as described in official guide or shown in the attached Demo below and add a package.json like this into the root-directory of the RN-project:
{
  "name": "MyApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.52.0",
    "react-native-svg": "^6.0.1-rc.2"
  },
  "devDependencies": {
    "babel-jest": "22.1.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.1.2",
    "react-test-renderer": "16.2.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

  1. run yarn install
  2. run react-native link
  3. cd to "ios"-directory containing the XCode-project itself
  4. Add a Podfile like this:
platform :ios, '8.0'

target 'MyApp' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for MyApp

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    'tvOS', # https://github.com/facebook/react-native/issues/17274#issuecomment-356427445
    # Remove tvOS when this commit is released: https://github.com/facebook/react-native/commit/9954499df1841cf997b6c6d02e9a267810c6180e

    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'RNSVG', :path => '../node_modules/react-native-svg'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'MyApp-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for MyApp-tvOS

  target 'MyApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

  1. run pod install

Expected Behavior

A successfully installation of react-native into any existing iOS-app.

Actual Behavior

The installation fails with installing the dependency "boost":

$ pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `GLog` from `../node_modules/react-native/third-party-podspecs/GLog.podspec`
Fetching podspec for `RNSVG` from `../node_modules/react-native-svg`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Using DoubleConversion (1.1.5)
Using Folly (2016.09.26.00)
Using GLog (0.3.4)
Using RNSVG (6.0.1-rc.2)
Using React (0.52.0)
Installing boost (1.59.0)

[!] Error installing boost
[!] /usr/bin/tar xfz /var/folders/cj/c_zjt5x12ps_6q93t023qc4w0000gn/T/d20180119-68008-1um62tb/file.tgz -C /var/folders/cj/c_zjt5x12ps_6q93t023qc4w0000gn/T/d20180119-68008-1um62tb

tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

The issue can be narrowed down with the verbose-mode of cocoapods:

pod --verbose install gives more insights:

-> Installing boost (1.59.0)
 > Http download
   $ /usr/bin/curl -f -L -o /var/folders/cj/c_zjt5x12ps_6q93t023qc4w0000gn/T/d20180118-67200-iuzhof/file.tgz http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz --create-dirs --netrc-optional

When i then run the curl-task it will download a static html page from sourceforge instead of a valid tar-gz-archive.

$> less /var/folders/cj/c_zjt5x12ps_6q93t023qc4w0000gn/T/d20180118-67200-iuzhof/file.tgz

gives:

<!doctype html>
<!-- Server: sfs-consume-19 -->
<html class="no-js" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />


        <script type='text/javascript'>
            /*global unescape, window, SF*/
            // Setup our namespace
            if (!window.SF) { window.SF = {}; }

I have already cleared the ~/.cocoapods cache and ~/.rncache. But this issue still persists on all our Mac-environments. Both Sierra and High Sierra.

There was already tickets opened around this issue but they get closed very fast without any change so i wonder if the wrong download url is caused by something of those pod specs that runs earlier before boost get installed (or something like that)?

Similar issues:

Any ideas how to fix this? I'm lost here...

Reproducible Demo

This repo is a good reproducible demo: https://github.com/msand/SVGPodTest

Locked

Most helpful comment

the same issure

All 4 comments

This issue was fixed automatically with https://github.com/facebook/react-native/commit/cf19833!

the same issure

the same issure, anybody can fix?

In my case: I used VPN and it worked

Was this page helpful?
0 / 5 - 0 ratings