Skip to content

cpp-lib template fails on lib created by create-react-native-library #13884

@hsjoberg

Description

@hsjoberg

Problem Description

Hi, I'm trying to set up a lib from create-react-native-library by following #12481 and https://github.com/microsoft/react-native-windows/wiki/Using-the-new-architecture-templates.

However, on a fresh lib without any coding changes it fails with the following errors in Metro:

 (NOBRIDGE) ERROR  TypeError: Cannot read property 'S' of undefined, js engine: hermes
 (NOBRIDGE) ERROR  TypeError: Cannot read property 'render' of undefined, js engine: hermes
 (NOBRIDGE) ERROR  TypeError: Cannot read property 'S' of undefined, js engine: hermes
 (NOBRIDGE) ERROR  TypeError: Cannot read property 'render' of undefined, js engine: hermes

image

Steps To Reproduce

I've uploaded a repro here. I'm just doing the following without any code modifications:

  1. Create a new lib:
npx --yes create-react-native-library@latest --slug rnwturbo --description rnwturbo --author-name "rnwturbo" --author-email rnwturbo@rnwturbo.com --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --type module-new --react-native-version 0.76.0-rc.1-7345250 --example test-app rnwturbo

cd rnwturbo
  1. Add latest react-native-windows canary build to the project in order to get the cpp-lib template:
yarn add react-native-windows@0.0.0-canary.868
  1. Add windows to the lib
yarn react-native init-windows --template cpp-lib --overwrite --logging
  1. Run the example app to observe the error (run twice depending on if you run into New arch app first builds sometimes fail with circular dependency error MSB4006 #13599)
yarn example windows

Expected Results

No response

CLI version

14.0.0

Environment

System:
  OS: Windows 11 10.0.22631
  CPU: "(32) x64 AMD Ryzen 9 7950X3D 16-Core Processor          "
  Memory: 44.58 GB / 95.71 GB
Binaries:
  Node:
    version: 21.6.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 3.6.1
    path: C:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.2.4
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.18362.0
      - 10.0.19041.0
      - 10.0.22621.0
IDEs:
  Android Studio: AI-241.19072.14.2412.12360217
  Visual Studio:
    - 17.11.35312.102 (Visual Studio Community 2022)
Languages:
  Java:
    version: 17.0.3
    path: /c/Program Files/ojdkbuild/java-17-openjdk-17.0.3.0.6-1/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0-rc.1
    wanted: 0.76.0-rc.1
  react-native-windows:
    installed: 0.0.0-canary.868
    wanted: 0.0.0-canary.868
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Community Modules

No response

Target Platform Version

10.0.22621

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

https://github.com/hsjoberg/rnwturbo

Metadata

Metadata

Assignees

Labels

Area: Turbo ModulesNew ArchitectureBroad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabricbug

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions