Skip to content

Expo Android app fails building: src/react-native directory missing in host package #159

@kraenhansen

Description

@kraenhansen

The src/react-native directory is expected by codegen which is failing the build of an example app using the host package at v0.2.0.

Either we'd just add that directory as an empty directory or we should update the react-native.config.js file to point to another directory or disable codegen all together, since we're not actively using it as part of implementing the host's TurboModule.

> expo run:android

› Building app...
Configuration on demand is an incubating feature.

> Configure project :
[ExpoRootProject] Using the following versions:
  - buildTools:  35.0.0
  - minSdk:      24
  - compileSdk:  35
  - targetSdk:   35
  - ndk:         27.1.12297006
  - kotlin:      2.0.21
  - ksp:         2.0.21-1.0.28

> Configure project :expo

Using expo modules
  - expo-constants (17.1.7)
  - expo-modules-core (2.4.2)
  - [📦] expo-asset (11.1.7)
  - [📦] expo-file-system (18.1.11)
  - [📦] expo-font (13.3.2)
  - [📦] expo-keep-awake (14.1.4)


> Task :react-native-node-api:generateCodegenSchemaFromJavaScript FAILED
node:fs:1716
  const stats = binding.lstat(
                        ^

Error: ENOENT: no such file or directory, lstat '/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native-node-api/src/react-native'
    at Object.lstatSync (node:fs:1716:25)
    at /Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema.js:108:15
    at Array.flatMap (<anonymous>)
    at expandDirectoriesIntoFiles (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema.js:107:6)
    at combineSchemasInFileList (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema.js:123:28)
    at combineSchemasInFileListAndWriteToFile (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema.js:142:20)
    at Object.<anonymous> (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js:82:1)
    at Module._compile (node:internal/modules/cjs/loader:1730:14)
    at Object..js (node:internal/modules/cjs/loader:1895:10)
    at Module.load (node:internal/modules/cjs/loader:1465:32) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/react-native-node-api/src/react-native'
}

Node.js v22.15.1

[Incubating] Problems report is available at: file:///Users/kraen.hansen/Repositories/node-api-example-lib/example-app/android/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-node-api:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1

* 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 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.

For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 2s
40 actionable tasks: 6 executed, 34 up-to-date
Error: /Users/kraen.hansen/Repositories/node-api-example-lib/example-app/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a exited with non-zero code: 1
Error: /Users/kraen.hansen/Repositories/node-api-example-lib/example-app/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/@expo/spawn-async/src/spawnAsync.ts:67:13)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1101:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
    ...
    at spawnAsync (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/@expo/spawn-async/src/spawnAsync.ts:28:21)
    at spawnGradleAsync (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:134:28)
    at assembleAsync (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:83:16)
    at runAndroidAsync (/Users/kraen.hansen/Repositories/node-api-example-lib/example-app/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:62:24)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android 🤖Anything related to the Android platform (Gradle, NDK, Android SDK)bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions