react-native: pod install fails (not M1) — 401 when installing Boost

Description

Following the docs, I’m initializing a new react-native with Typescript repo with the command

npx react-native init myproject --template react-native-template-typescript

Upon running that command, I get the following:

✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./myproject/ios && pod install".

So I cd into the ios/ directory and run pod install. Everything installs propery, but when I get to boost…

Installing boost (1.76.0)

[!] Error installing boost
[!] /usr/bin/curl -f -L -o /var/folders/55/_ncpv5xd2hj2q2_k5m2bmn6r0000gn/T/d20220321-2395-th53eu/file.tbz https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.5.1'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    80    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 401

I understand that it’s the request to jfrog.io that’s giving me the 401, but how do I get around this? I’m not even clear on why access to this package would be forbidden in the first place. Strangely, I can install the tar.bz2 file directly just by putting that URL into my address bar. Why would it return a 401 to cURL?

I’m a web developer so I’m used to the npm ecosystem and have never faced a 401 before.

What can I do to move past this?

Version

0.67.4

Output of npx react-native info

info Fetching system and libraries information… System: OS: macOS 12.1 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 294.95 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.19.1 - /usr/local/opt/node@14/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn npm: 6.14.16 - /usr/local/opt/node@14/bin/npm Watchman: 2021.10.18.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.3 System Images: android-26 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 3.6 AI-192.7142.36.36.6392135 Xcode: 12.0/12A7209 - /usr/bin/xcodebuild Languages: Java: 1.8.0_252 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  1. run npx react-native init myproject --template react-native-template-typescript
  2. cd into ios
  3. run pod install

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

No response

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 52 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I found a workaround, though admittedly it’s pretty lame and is no better than a bandaid solution. The approach is to download the file and then source it from the local filesystem, rather than making a network call:

  1. Download the tar.bz2 file from https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2
  2. move the (compressed) file to node_modules/react-native/third-party-podspecs
  3. open node_modules/react-native/third-party-podspecs/boost.podspec
  4. change the :http part of the spec.source key to:
:http => 'file:' + __dir__ + '/boost_1_76_0.tar.bz2'
  1. run pod install

note: you may need to adjust the version of the boost package your project specifies.

For workaround solution. You don’t need to download the tar.bz2. And move to node_modules/react-native/third-party-podspecs. Only change line spec.source = { :http => ‘https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2’, :sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ } to spec.source = { :http => ‘https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2’, :sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ } in file node_modules/react-native/third-party-podspecs/boost.podspec

i think jfrog close their server. You may need to change 76 if you use another version

  1. open node_modules/react-native/third-party-podspecs/boost.podspec

Replaced

spec.source = { :http => ‘https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2’, :sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ }

              with

spec.source = { :http => ‘https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2’}

Worked for me:

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install
  1. open node_modules/react-native/third-party-podspecs/boost.podspec

Replaced

spec.source = { :http => ‘https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2’, :sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ }

              with

spec.source = { :http => ‘https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2’}

this solution saved my project 🥹 to install the newest version of boost use this link : https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2

@Tycholiz I resolved my issue with command: pod repo update

try git config --global core.autocrlf false brew install cocoapods

Edit: or just read https://github.com/facebook/react-native/issues/42180 as suggested above

If you find yourself here on react-native v0.69.4 like I did, getting this error:

Installing boost (1.76.0)
[!] Error installing boost
Verification checksum was incorrect, expected f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41, got 79e6d3f986444e5a80afbeccdaf2d1c1cf964baa8d766d20859d653a16c39848

You will need to apply a patch to the package like so

diff --git a/node_modules/react-native/third-party-podspecs/boost.podspec b/node_modules/react-native/third-party-podspecs/boost.podspec
index 2f1fcc4..2377c4e 100644
--- a/node_modules/react-native/third-party-podspecs/boost.podspec
+++ b/node_modules/react-native/third-party-podspecs/boost.podspec
@@ -10,7 +10,7 @@ Pod::Spec.new do |spec|
   spec.homepage = 'http://www.boost.org'
   spec.summary = 'Boost provides free peer-reviewed portable C++ source libraries.'
   spec.authors = 'Rene Rivera'
-  spec.source = { :http => 'https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2',
+  spec.source = { :http => 'https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2',
                   :sha256 => 'f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41' }
 
   # Pinning to the same version as React.podspec.

jfrog is now a paid service, which I verified running these commands:

» curl -O https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2
file 
» file boost_1_76_0.tar.bz2                              
boost_1_76_0.tar.bz2: HTML document text, ASCII text, with CRLF line terminators
» cat boost_1_76_0.tar.bz2                                   
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

I experienced this yesterday - no idea why. The boost install step has been hanging for several years for me. Only happens occasionally. I thought maybe it was a DNS issue or something like that, tried using a VPN (I’m in the EU). Anyway, this clean step worked for me:

cd ios && rm -rf Pods && rm -rf Podfile.lock && rm -rf build && pod deintegrate && cd ..

…then run pod install

The key fix for me was adding deintegrate.

Updating cocoapods via sudo gem install cocoapods fixed this issue.

Worked for me:

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install

This worked for me. Thank you

I am still seing this issue. Is there anything besides the workaround? A lot of people seem to have reported this.

@Tycholiz I resolved this issue by removing the following line from ~/.netrc.

machine github.com
  login xxxxx
  password xxxxxx

What worked for me was just waiting the download… The link was downloading on an average of 25KB/s. After waiting for a loooong time it worked.

I’m pretty sure this issue is related to something at the network level. I’m not sure what my exact setup was at the time, but see if you are on a VPN. Maybe even try a different wifi network to see if the result changes.

It’s quite a strange issue and I’m not exactly sure what to think about it

Closing as I believe this was a transient issue, related to local network configuration (.netrc file, VPNs or flakyness on cocoapod side). Feel free to re-open if the issue persists consistently.

I’ve also tested this locally on the RC for 0.69, and everything works 👍

Updating cocoapods via sudo gem install cocoapods fixed this issue.

running pod deintegrate as some people have suggested, deletes quite a few lines of code in ios/projectName.xcodeproj/project.pbxproj file.

is this okay?

either way, this solution sadly didnt work for me.

manually editing node_modules/ would only work locally, and would still fail on CI builds.(even changing it locally didnt work for me)

is this a widespread problem people have? i just got the problem yesterday, while this issue is a year old.

@Tycholiz I resolved this issue by removing the following line from ~/.netrc.

machine github.com
  login xxxxx
  password xxxxxx

this worked for me

@URvesh109 Thanks but it didn’t work image

Image

Replace this file code with the following code and chill

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

Pod::Spec.new do |spec|
  spec.name = 'boost'
  spec.version = '1.76.0'
  spec.license = { :type => 'Boost Software License', :file => "LICENSE_1_0.txt" }
  spec.homepage = 'http://www.boost.org'
  spec.summary = 'Boost provides free peer-reviewed portable C++ source libraries.'
  spec.authors = 'Rene Rivera'
  spec.source = { :http => 'https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2',
                  :sha256 => 'f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41' }

  # Pinning to the same version as React.podspec.
  spec.platforms = { :ios => '11.0' }
  spec.requires_arc = false

  spec.module_name = 'boost'
  spec.header_dir = 'boost'
  spec.preserve_path = 'boost'
end

For workaround solution. You don’t need to download the tar.bz2. And move to node_modules/react-native/third-party-podspecs. Only change line spec.source = { :http => ‘https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2’, :sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ } to spec.source = { :http => ‘https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2’, :sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ } in file node_modules/react-native/third-party-podspecs/boost.podspec

i think jfrog close their server. You may need to change 76 if you use another version

This is really worked for me. Thanks a lot 😃