npm start hangs on React Native boilerplate Expo app.

Followed all the documentation to get this booted

Looking for JS files in
   /Users/cex/repos/GamingVideos 

Loading dependency graph, done.

It just hangs… This is apparently no that uncommon https://github.com/facebook/react-native/issues/25650 One suggestion is that node >= 12.5 has memory issues and that downgrading can help. I’m one of those people that tries to push the latest version of everthing and if you’ve ever dealt with huge amounts of legacy dependencies in Rails apps with lots of gem you’d probably agree this is mostly sane.

Not sure how you downgrade using Brew https://medium.com/@georgeenathomas/3-step-process-to-downgrade-node-version-using-homebrew-bc0b0a72ae27

New-MacBook-Pro:GamingVideos cex$ brew search node
==> Formulae
leafnode            node ✔              node@12             nodebrew
libbitcoin-node     node-build          node@8              nodeenv
llnode              node@10             node_exporter       nodenv

==> Casks
nodebox                    nodeclipse                 soundnode

If you meant "node" specifically:
true

Seems like I have version 12 installed.

New-MacBook-Pro:GamingVideos cex$ brew unlink node
Unlinking /usr/local/Cellar/node/13.1.0... 7 symlinks removed
New-MacBook-Pro:GamingVideos cex$ brew link node@12
Error: No such keg: /usr/local/Cellar/node@12

Well perhaps not…

New-MacBook-Pro:GamingVideos cex$ brew install node@12
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
bit                 ruby-build          swiftformat         vte3
gjs                 stellar-core        v8

==> Downloading https://homebrew.bintray.com/bottles/node@12-12.13.1.mojave.bott
==> Downloading from https://akamai.bintray.com/70/7080b09d842a2c05d7b61c2ac121f
######################################################################## 100.0%
==> Pouring node@12-12.13.1.mojave.bottle.tar.gz
==> Caveats
node@12 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have node@12 first in your PATH run:
  echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile

For compilers to find node@12 you may need to set:
  export LDFLAGS="-L/usr/local/opt/node@12/lib"
  export CPPFLAGS="-I/usr/local/opt/node@12/include"

==> Summary
  /usr/local/Cellar/node@12/12.13.1: 4,225 files, 52.8MB

Now to relink it

New-MacBook-Pro:GamingVideos cex$ brew link node@12
Warning: node@12 is keg-only and must be linked with --force

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile
New-MacBook-Pro:GamingVideos cex$ brew link node@12 --force
Linking /usr/local/Cellar/node@12/12.13.1... 
Error: Could not symlink bin/npm
Target /usr/local/bin/npm
already exists. You may want to remove it:
  rm '/usr/local/bin/npm'

To force the link and overwrite all conflicting files:
  brew link --overwrite node@12

To list all files that would be deleted:
  brew link --overwrite --dry-run node@12

I’ve got to wing it here because I don’t know what is going to happen.

New-MacBook-Pro:GamingVideos cex$ brew link --overwrite node@12 --force
Linking /usr/local/Cellar/node@12/12.13.1... 3744 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile
New-MacBook-Pro:GamingVideos cex$ node -v
v12.13.1

Looks like it’s done something right…. ok same damn thing. I am now going to nuke the project re-install everything and hopefully this time…

npm install -g expo-cli
expo init GamingVideos
cd GamingVideos
yarn android

Yeah….um…no.

New-MacBook-Pro:GamingVideos cex$ yarn android
yarn run v1.19.2
$ react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip

Exception in thread "main" javax.net.ssl.SSLException: Received fatal alert: protocol_version

Ok forget it. No React Native for me today.

Update: After incidentally upgrading to the latest MacOSX, the error message changes

<New-MacBook-Pro:GamingVideos cex$ yarn android
yarn run v1.19.2
$ react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)…
No Java runtime present, requesting install.
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with —verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Ok, now I need to install a Java Runtime, there was clearly one here before but hey, if that solves it…

https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html

New-MacBook-Pro:GamingVideos cex$ yarn android
yarn run v1.19.2
$ react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip
...............................................................................................................
Unzipping /Users/cex/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1-all.zip to /Users/cex/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd
Set executable permissions for: /Users/cex/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1/bin/gradle

Welcome to Gradle 4.10.1!

Here are the highlights of this release:
 - Incremental Java compilation by default
 - Periodic Gradle caches cleanup
 - Gradle Kotlin DSL 1.0-RC6
 - Nested included builds
 - SNAPSHOT plugin versions in the `plugins {}` block

For more details see https://docs.gradle.org/4.10.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
cache fileHashes.bin (/Users/cex/repos/GamingVideos/android/.gradle/4.10.1/fileHashes/fileHashes.bin) is corrupt. Discarding.

> Configure project :app

Installing unimodules:
 unimodules-core@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/@unimodules/core
 unimodules-react-native-adapter@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/@unimodules/react-native-adapter
 expo-app-loader-provider@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-app-loader-provider
 expo-constants@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-constants
 expo-file-system@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-file-system
 expo-font@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-font
 expo-keep-awake@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-keep-awake
 expo-linear-gradient@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-linear-gradient
 expo-location@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-location
 expo-permissions@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-permissions
 expo-sqlite@7.0.0 from /Users/cex/repos/GamingVideos/node_modules/expo-sqlite
 expo-web-browser@7.0.1 from /Users/cex/repos/GamingVideos/node_modules/expo-web-browser
 unimodules-barcode-scanner-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-barcode-scanner-interface
 unimodules-camera-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-camera-interface
 unimodules-constants-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-constants-interface
 unimodules-face-detector-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-face-detector-interface
 unimodules-file-system-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-file-system-interface
 unimodules-font-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-font-interface
 unimodules-image-loader-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-image-loader-interface
 unimodules-permissions-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-permissions-interface
 unimodules-sensors-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-sensors-interface
 unimodules-task-manager-interface@4.0.0 from /Users/cex/repos/GamingVideos/node_modules/unimodules-task-manager-interface

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 45s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Maybe this can help.

https://stackoverflow.com/questions/32634352/react-native-android-build-failed-sdk-location-not-found

Ok, followed that, now getting a error to do with missing licences. I couldn’t see a way on forcing licences to install. and checking in Android Studio I can see that Android 10.0 (Q) was installed. I selected Android 9.0 (Pie) just to see if it forced me to click yes on a licence agreement.

It didn’t but now yarn android on my project is doing something more.

Checking the license for package Android SDK Build-Tools 28.0.3 in /Users/cex/Library/Android/sdk/licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
Installing Android SDK Build-Tools 28.0.3 in /Users/cex/Library/Android/sdk/build-tools/28.0.3
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.

But then…

> Task :app:installDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

Ok, so let’s start again on a different machine…and this is not making me happy. Documentation also says you can use npm start or expo start

Ok, so it was hanging because it needed permissions. Works. There was other wise nothing wrong at all. I love technology, it makes me happy.