Description
Description
RN 0.60+ made usage of @react-native-community/cli required (at least for Android).
in 0.61 @react-native-community/cli broke application builds that do not comply with their new relative-directory structure requirement (which is also not well documented)
This a regression of capabilities offered by previous releases of RN.
If one has:
project/FRONTEND/androidapps/app1
project/FRONTEND/rn.common/ <-- root for JS (eg node_modules, package.json etc)
This directory structure no longer works with 0.61+ React native releases.
The new CLI tool ignores react-native Android project template documentation,
when it comes to specifying the directory 'where package.json lives':
https://github.com/facebook/react-native/blob/master/template/android/app/build.gradle
project.ext.react = [
// the root of your project, i.e. where "package.json" lives
// root: "../../",
]
And, instead, @react-native-community/cli tries to infer where package.json lives by using nodeJS module resolution guessing (which is done simply by invoking node in the directory root project direction of Android app, and having nodeJS to search for node_modules .. .which it cannot find, in the above described case).
The issue was reported in October 2019.
react-native-community/cli#804
Now it is marked as closed, but the issue is not fixed (and is not re-opened).
There is no way to disable autolinking feature in the new CLI (which is where the regression was introduced), so no way to workaround this regression.
React Native version:
Please note, the issue first appeared in RN 0.60, reported but not fixed since October 2019.
So this bug report requests that RN makes necessary changes to make @react-native-community/cli optional.
[v@host rn.common]$ ./node_modules/.bin/react-native info
info Fetching system and libraries information...
System:
OS: Linux 5.5 Fedora 31 (Thirty One) 31 (Thirty One)
CPU: (4) x64 Intel(R) Core(TM) i7 CPU
Memory: 511.33 MB / 11.51 GB
Shell: 5.0.11 - /bin/bash
Binaries:
Node: 12.16.1 - /bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: javac 14 - /bin/javac
Python: 3.7.6 - /bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: ^0.62 => 0.62.2
npmGlobalPackages:
react-native: Not Found
[v@host rn.common]$
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Setup an android project such as
project/FRONTEND/androidapps/app1
project/FRONTEND/rn.common/ <-- root for JS (eg node_modules, package.json etc)
Expected Results
see the detailed example, with this regression -- the build on Android fails
react-native-community/cli#804