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 2 years ago
  • Reactions: 2
  • Comments: 47 (4 by maintainers)

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

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’}

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

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

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.

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.

Updating cocoapods via sudo gem install cocoapods fixed this issue.

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

machine github.com
  login xxxxx
  password xxxxxx
  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

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.

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

machine github.com
  login xxxxx
  password xxxxxx

this worked for me

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

@URvesh109 Thanks but it didn’t work image

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.

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 😃