Cannot get property 'packageName' on null object
See original GitHub issueMoving from #537
Environment
System: OS: macOS 10.15 CPU: (4) x64 Intel® Core™ i5-6267U CPU @ 2.90GHz Memory: 2.70 GB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.8.0 - /var/folders/xh/gcxkb1qx2rd3fmqz5vxrs2lh0000gn/T/yarn–1567321836628-0.386672585258681/node Yarn: 1.17.3 - /var/folders/xh/gcxkb1qx2rd3fmqz5vxrs2lh0000gn/T/yarn–1567321836628-0.386672585258681/yarn npm: 6.10.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 Android SDK: API Levels: 28 Build Tools: 28.0.3 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 10.3/10G8 - /usr/bin/xcodebuild
Description
Can’t get react-native 0.61 to work on a monorepo on Android. Build fails with the error: Cannot get property 'packageName' on null object. iOS works as expected.
Running yarn react-native config returns this result:
{
"root": "/Users/user/Projects/react-native-web-monorepo",
"reactNativePath": "/Users/user/Projects/react-native-web-monorepo/node_modules/react-native",
"dependencies": {},
"commands": [],
"assets": [],
"platforms": {},
"haste": {
"providesModuleNodeModules": [],
"platforms": []
},
"project": {}
}
Using nohoist or installing react-native inside packages/mobile instead of the root is not an option because that causes a range of other issues.
Reproducible Demo
Branch rn61 with error: https://github.com/brunolemos/react-native-web-monorepo/tree/rn61
Branch master working, with workarounds: https://github.com/brunolemos/react-native-web-monorepo
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:25 (7 by maintainers)

Top Related StackOverflow Question
I modify node_modules/@react-native-community/cli-platform-android/native_modules.gradle at line 157 cmdProcess = Runtime.getRuntime().exec(command) change to cmdProcess = Runtime.getRuntime().exec(command,null,new File(System.getProperty(“user.dir”)).getParentFile()) work OK
Having same issue with an example app of a package which contains no native modules.
E: Adding this to react-native.config.js resolved the issue: