Cannot run Ignite RN app in yarn monorepo
Describe the bug
Hi!
Cannot run Ignite RN app on iOS in yarn monorepo (yarn v1.22.22).
Steps to reproduce:
-
Start a monorepo with
npx create-turbo@latestselectyarnas a package manager -
cd apps -
Ignite RN project
npx ignite-cli@latest new pizza-appwith following options: -
cd pizza-app -
yarn install -
According to expo monorepo guidelines:
- create
index.jswith the following content:
import { registerRootComponent } from "expo";
import App from "./App";
registerRootComponent(App);
- update
package.json(set"main": "index.js",) - update
metro.config.jsas in expo guidelines
npx pod-installyarn ios- Observe infinite errors:
ERROR TypeError: Cannot assign to property 'username' which has only a getter, js engine: hermes
ERROR TypeError: Cannot assign to property 'username' which has only a getter, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
ERROR Invariant Violation: No callback found with cbID 2 and callID 1 for module <unknown>. Args: '[{"app_state":"active"}]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 18 and callID 9 for module <unknown>. Args: '[{"app_state":"active"}]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 41 and callID 20 for module <unknown>. Args: '[0]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 45 and callID 22 for module <unknown>. Args: '[1]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 49 and callID 24 for module <unknown>. Args: '[2]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 63 and callID 31 for module <unknown>. Args: '[3]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 77 and callID 38 for module <unknown>. Args: '[4]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 81 and callID 40 for module <unknown>. Args: '[5]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 85 and callID 42 for module <unknown>. Args: '[6]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 89 and callID 44 for module <unknown>. Args: '[7]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 117 and callID 58 for module <unknown>. Args: '[8]', js engine: hermes
ERROR Invariant Violation: No callback found with cbID 123 and callID 61 for module <unknown>. Args: '[9]', js engine: hermes
...
[!IMPORTANT] Sample project: https://github.com/mausic/turborepo-ignite
Ignite version
9.7.1
Additional info
npx ignite-cli doctor
System
platform darwin
arch arm64
cpu 10 cores Apple M1 Pro
directory pizza-app /Users/mausic/Projects/turborepo-rn/apps/pizza-app
JavaScript (and globally-installed packages)
node 20.11.1 /Users/mausic/.nvm/versions/node/v20.11.1/bin/node
npm 10.8.1 /Users/mausic/.nvm/versions/node/v20.11.1/bin/npm
@aws-amplify/cli 12.10.1
@microsoft/rush 5.93.1
@nestjs/cli 9.1.4
apollo 2.34.0
aws-cdk 2.141.0
corepack 0.10.0
eas-cli 7.5.0
graphql 16.6.0
npm 10.8.1
pnpm 7.27.1
rush 0.0.2
ts-node 10.9.1
typescript 4.9.4
vercel 34.1.9
yarn 1.22.22
yarn 1.22.22 /Users/mausic/.nvm/versions/node/v20.11.1/bin/yarn
create-amplify 1.0.1
create-next-app 13.0.7
create-turbo 2.0.9
create-vite 5.2.3
pnpm 9.5.0 /Users/mausic/Library/pnpm/pnpm
<no pnpm global package info available>
bun - not installed
expo 51.0.22 managed
Ignite
ignite-cli 9.7.1 /Users/mausic/.npm/_npx/e31027f3785124a8/node_modules/.bin/ignite
ignite src build /Users/mausic/.npm/_npx/e31027f3785124a8/node_modules/ignite-cli/build
Android
java - not installed
android home - undefined
iOS
xcode 15.4
cocoapods 1.11.3 /Users/mausic/.rvm/gems/ruby-2.7.2/bin/pod
Tools
git git version 2.39.3 (Apple Git-146) /usr/bin/git
[!TIP] The issue is resolved if we Ignite the second RN app in the same monorepo.
Steps to reproduce:
-
Take the codebase from original issue or sample repo
-
cd apps -
npx ignite-cli@latest new dummy-appusing the following options: -
yarn install -
cd pizza-app -
npx pod-install -
yarn ios -
Success!
So, I'm assuming, the issue might be related to yarn packages management (and probably hoisting) and pods management.
I am not sure that this is the Ignite team responsibility, however, I would be thankful for any advise on resolving the issue without creating the second RN app.
yeah we have an open item for #1981 - I will discuss it with @trevor-coleman and @joshuayoes to see if we can't debug your repro example, thanks for setting that up
Yes, we're working on a mono repo guide / recipe. It will be released alongside v10.
cc: @frankcalise