Skip to content

Does not compile on newly created React Native app #353

@fr-an-k

Description

@fr-an-k
  • Project: nodejs-mobile-react-native
  • Version: 16.17.10
  • Mobile device: S933L
  • Mobile OS and version: Android 8.1
  • Development Node.js: v18.14.0
  • Development platform: x64, Microsoft Windows 11 Pro (10.0.22621 N/A Build 22621)
    "react": "18.2.0",
    "react-native": "0.72.1"

I created a new React Native project, added nodejs-mobile-react-native (yarn), started the debug app, but it fails:

ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

The documentation does not mention how to avoid this.

Full output:

Details
yarn run android 

yarn run v1.22.19
$ react-native run-android
warn Package nodejs-mobile-react-native contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info JS server already running.
info Installing the app...

> Task :nodejs-mobile-react-native:buildCMakeDebug[x86] FAILED
C/C++: ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings
50 actionable tasks: 9 executed, 41 up-to-date
                                                                                                                          
info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\.cxx\Debug\1k6s421m\x86'

  C++ build system [build] failed while executing:
      @echo off
      "C:\\Users\\frank\\AppData\\Local\\Android\\Sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^
        -C ^
        "C:\\Users\\frank\\repos\\test_react_native_nodejs\\node_modules\\nodejs-mobile-react-native\\android\\.cxx\\Debug\\1k6s421m\\x86" ^
        nodejs-mobile-react-native-native-lib
    from C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android
  ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

* 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

BUILD FAILED in 4s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]'. > com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\.cxx\Debug\1k6s421m\x86' C++ build system [build] failed while executing: @echo off "C:\\Users\\frank\\AppData\\Local\\Android\\Sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^ -C ^ "C:\\Users\\frank\\repos\\test_react_native_nodejs\\node_modules\\nodejs-mobile-react-native\\android\\.cxx\\Debug\\1k6s421m\\x86" ^ nodejs-mobile-react-native-native-lib from C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it * 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 BUILD FAILED in 4s.
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.

Cleaned and using npm install:

Details
npm run android 


> test_react_native_nodejs@0.0.1 android
> react-native run-android

warn Package nodejs-mobile-react-native contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info JS server already running.
info Installing the app...

> Task :nodejs-mobile-react-native:processDebugManifest
package="com.janeasystems.rn_nodejs_mobile" found in source AndroidManifest.xml: C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\src\main\AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

> Task :nodejs-mobile-react-native:compileDebugJavaWithJavac

> Task :nodejs-mobile-react-native:configureCMakeDebug[arm64-v8a]
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++:   No project() command is present.  The top-level CMakeLists.txt file must                                         
C/C++:   contain a literal, direct call to the project() command.  Add a line of
C/C++:   code such as
C/C++:     project(ProjectName)
C/C++:   near the top of the file, but after cmake_minimum_required().
C/C++:   CMake is pretending there is a "project(Project)" command on the first
C/C++:   line.
C/C++: This warning is for project developers.  Use -Wno-dev to suppress it.

> Task :nodejs-mobile-react-native:configureCMakeDebug[armeabi-v7a]
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++:   No project() command is present.  The top-level CMakeLists.txt file must
C/C++:   contain a literal, direct call to the project() command.  Add a line of
C/C++:   code such as
C/C++:     project(ProjectName)
C/C++:   near the top of the file, but after cmake_minimum_required().
C/C++:   CMake is pretending there is a "project(Project)" command on the first
C/C++:   line.
C/C++: This warning is for project developers.  Use -Wno-dev to suppress it.

> Task :nodejs-mobile-react-native:configureCMakeDebug[x86]
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++:   No project() command is present.  The top-level CMakeLists.txt file must
C/C++:   contain a literal, direct call to the project() command.  Add a line of
C/C++:   code such as
C/C++:     project(ProjectName)
C/C++:   near the top of the file, but after cmake_minimum_required().
C/C++:   CMake is pretending there is a "project(Project)" command on the first
C/C++:   line.
C/C++: This warning is for project developers.  Use -Wno-dev to suppress it.

> Task :nodejs-mobile-react-native:buildCMakeDebug[x86] FAILED
C/C++: ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings
49 actionable tasks: 42 executed, 7 up-to-date
                                                                                                                          
info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor                                                                                                                     
                                                                                                                          
Note: C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\src\main\java\com\janeasystems\rn_nodejs_mobile\RNNodeJsMobileModule.java uses or overrides a deprecated API.                                   
Note: Recompile with -Xlint:deprecation for details.                                                                      
Note: C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\src\main\java\com\janeasystems\rn_nodejs_mobile\RNNodeJsMobileModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\.cxx\Debug\1k6s421m\x86'

  C++ build system [build] failed while executing:
      @echo off
      "C:\\Users\\frank\\AppData\\Local\\Android\\Sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^
        -C ^
        "C:\\Users\\frank\\repos\\test_react_native_nodejs\\node_modules\\nodejs-mobile-react-native\\android\\.cxx\\Debug\\1k6s421m\\x86" ^
        nodejs-mobile-react-native-native-lib
    from C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android
  ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

* 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

BUILD FAILED in 9s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\src\main\java\com\janeasystems\rn_nodejs_mobile\RNNodeJsMobileModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\src\main\java\com\janeasystems\rn_nodejs_mobile\RNNodeJsMobileModule.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]'. > com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android\.cxx\Debug\1k6s421m\x86' C++ build system [build] failed while executing: @echo off "C:\\Users\\frank\\AppData\\Local\\Android\\Sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^ -C ^ "C:\\Users\\frank\\repos\\test_react_native_nodejs\\node_modules\\nodejs-mobile-react-native\\android\\.cxx\\Debug\\1k6s421m\\x86" ^ nodejs-mobile-react-native-native-lib from C:\Users\frank\repos\test_react_native_nodejs\node_modules\nodejs-mobile-react-native\android ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/1k6s421m/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it * 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 BUILD FAILED in 9s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions