Skip to content

error: require() of ES Module [...] ./react-native-monorepo-config/index.js #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
ACHP opened this issue May 16, 2025 · 1 comment
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@ACHP
Copy link

ACHP commented May 16, 2025

Description

I just created a library using and when doing

npx create-react-native-library@latest awesome-library
yarn
(cd example/ios && pod install)
cd example
yarn start

And got this error

error require() of ES Module /Users/alexischappron/projects/awesome-library/example/node_modules/react-native-monorepo-config/index.js from /Users/alexischappron/projects/awesome-library/example/metro.config.js not supported.
Instead change the require of index.js in /Users/alexischappron/projects/awesome-library/example/metro.config.js to a dynamic import() which is available in all CommonJS modules.
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/alexischappron/projects/awesome-library/example/node_modules/react-native-monorepo-config/index.js from /Users/alexischappron/projects/awesome-library/example/metro.config.js not supported.
Instead change the require of index.js in /Users/alexischappron/projects/awesome-library/example/metro.config.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/alexischappron/projects/awesome-library/example/metro.config.js:3:29)

Probably caused by ebe4512 but not sure …

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

Fabric view

Link to repro

https://github.com/callstack/react-native-builder-bob

Environment

System:
OS: macOS 15.3.1
CPU: (12) arm64 Apple M3 Pro
Memory: 261.20 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.11.0
path: ~/.nvm/versions/node/v20.11.0/bin/node
Yarn:
version: 3.6.1
path: ~/.nvm/versions/node/v20.11.0/bin/yarn
npm:
version: 10.2.4
path: ~/.nvm/versions/node/v20.11.0/bin/npm
Watchman:
version: 2024.08.12.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /var/folders/12/_ffy101j76zccg89mklrbbdw0000gn/T/frum_93167_1747378318235/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "23"
- "25"
- "28"
- "29"
- "30"
- "31"
- "33"
- "34"
- "35"
Build Tools:
- 28.0.3
- 29.0.2
- 30.0.2
- 30.0.3
- 31.0.0
- 32.0.0
- 33.0.0
- 33.0.1
- 34.0.0
- 35.0.0
- 35.0.1
System Images:
- android-24 | ARM 64 v8a
- android-28 | ARM 64 v8a
- android-29 | Google APIs ARM 64 v8a
- android-30 | Google APIs ARM 64 v8a
- android-30 | Google Play ARM 64 v8a
- android-31 | Google APIs ARM 64 v8a
- android-31 | Google Play Intel x86_64 Atom
- android-32 | Google APIs ARM 64 v8a
- android-33-ext5 | Google Play ARM 64 v8a
- android-35 | ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: EAP AI-243.23654.117.2432.13021186 AI-243.23654.117.2432.13021186
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /Users/alexischappron/.asdf/shims/javac
Ruby:
version: 2.7.6
path: /var/folders/12/_ffy101j76zccg89mklrbbdw0000gn/T/frum_93167_1747378318235/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.2
wanted: 0.79.2
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true

@ACHP ACHP added the bug Something isn't working label May 16, 2025
@ACHP
Copy link
Author

ACHP commented May 16, 2025

Ok I'm dumb, my node version wasn't right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant