React-native CLI?

Are there any install instructions for the react-native cli?

I am trying to install tools for the Android build and followed all the instructions but I get command not found when i run

react-native run-android

The React-Native site says:

You will need Node, the React Native command line interface, a JDK, and Android Studio.

but I can't see where it shows how to install the command line interface.

Maybe try to get a sample app working first, following the instructions in the RN website.

You can install the cli with npm i -g react-native or use npx as they suggest.

Ok, good idea.

BTW In their section "creating a new application" they also say:

If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.

I tried with npx but got another error. I'll look at that closer though. Thanks.

I now built and ran a sample app successfully. But when I try the Joplin app:

npm run tsc
cd ReactNativeClient
npm install
npx react-native run-android

it does something for a while (lots of fetchMetadata, extact and refresh messages) and then stops with an error:

error Unrecognized command "run-android".

Is there anything obvious I am doing wrong?

For reference, the versions I have installed are:

  Binaries:
    Node: 12.14.0 - ~/Downloads/node-v12.14.0-linux-x64/bin/node
    Yarn: 1.21.1 - /usr/bin/yarn
    npm: 6.13.4 - ~/Downloads/node-v12.14.0-linux-x64/bin/npm
  SDKs:
    Android SDK:
      API Levels: 28
      Build Tools: 28.0.3
      System Images: android-28 | Intel x86 Atom_64
  npmPackages:
    react: ^16.8.3 => 16.8.6 
    react-native: 0.59.10 => 0.59.10

Ok, I think I’ve got it running now. I needed to restart the metro server.

For me react-native run-android doesn’t always work, so I get it working in two steps:

First, I run ./gradlew installDebug from the “android” folder. Then I run ./start_server.sh.

run-android does both of this automatically but sometimes fails at one or the other, so it can be better to run them separately.