Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot init RN project #36636

Closed
HadiModarres opened this issue Mar 24, 2023 · 4 comments
Closed

Cannot init RN project #36636

HadiModarres opened this issue Mar 24, 2023 · 4 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer

Comments

@HadiModarres
Copy link

HadiModarres commented Mar 24, 2023

Description

React Native init takes hours and then fails.

After using npx react-native@latest init --verbose TutorialProject I found out that it's trying to download 460MB for a hermes-engine package from Maven, (https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.4/react-native-artifacts-0.71.4-hermes-ios-debug.tar.gz). The problem is, download from Maven has a speed of only 40KB/s (my connection speed is 100Mb/s). So it takes 3-4 hours to download 460MB with that speed and curl fails during it.

React Native Version

0.71.4

Output of npx react-native info

System:
OS: macOS 13.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 4.94 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.npm-packages/bin/yarn
npm: 8.12.1 - /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.12.0 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 17.0.5 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

npx react-native@latest init --verbose TutorialProject

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

npx react-native@latest init --verbose TutorialProject

@cortinico
Copy link
Contributor

The problem is, download from Maven has a speed of only 40KB/s (my connection speed is 100Mb/s). So it takes 3-4 hours to download 460MB with that speed and curl fails during it.

I'm sorry but this is a compromise we'll have to do.
In React Native 0.69, we shipped hermes with build from source, and folks complained as the local build was taking too long.
We moved to prebuilts, which means that now you need to download a bigger archive but build will be faster. Sadly, if you connection is slow, you will have a harder time.

As a workaround you can use JSC which ships with smaller artifacts and will be faster to download.

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Triage 🔍 labels Mar 31, 2023
@HadiModarres
Copy link
Author

A compromise is unnecassry as there exist quite a few solutions:

  • Host the prebuilt Hermes on a website with better download speeds, note that this is a problem with Maven, my connection speed isn't slow, only slow downloads from Maven
  • Give users the choice of building from source or download prebuilt
  • Use another commandline tool or curl options to retry a broken download
  • Update the Readme to inform users about downloading the hermes tarball separately and using HERMES_ENGINE_TARBALL_PATH with pod install
  • Add an option to init to opt out of Hermes and use JSC

Not being able to initialize a React Native project easily is a bad experience

@cortinico
Copy link
Contributor

  • Host the prebuilt Hermes on a website with better download speeds, note that this is a problem with Maven, my connection speed isn't slow, only slow downloads from Maven

We're hosted on Sonatype which has quite strong CDNs as they distribute Maven artifacts all over the place for all the android projects.. You're free to redistribute the artifact or use a proxy as you see fit.
It downloads for me in a matter of seconds so I don't believe they have a reduced bandwidth.

  • Give users the choice of building from source or download prebuilt

That's possible, we do have a guide here for Android: https://reactnative.dev/contributing/how-to-build-from-source

  • Use another commandline tool or curl options to retry a broken download

You can manually download artifacts using this web UI or any command line tools:
https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/

  • Update the Readme to inform users about downloading the hermes tarball separately and using HERMES_ENGINE_TARBALL_PATH with pod install

Yup that's doable, We'll be happy to receive a website PR here http://github.com/facebook/react-native-website

@HadiModarres
Copy link
Author

HadiModarres commented Mar 31, 2023

Thanks for the information, appreciate that.
I used mobile 4g network, and download speed was back to normal!

I'll try to get that PR in for HERMES_ENGINE_TARBALL_PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests

2 participants