Skip to content
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

Cannot run Ignite RN app in yarn monorepo #2715

Open
mausic opened this issue Jul 26, 2024 · 3 comments · May be fixed by infinitered/ignite-cookbook#173
Open

Cannot run Ignite RN app in yarn monorepo #2715

mausic opened this issue Jul 26, 2024 · 3 comments · May be fixed by infinitered/ignite-cookbook#173
Assignees
Labels
Milestone

Comments

@mausic
Copy link

mausic commented Jul 26, 2024

Describe the bug

Hi!
Cannot run Ignite RN app on iOS in yarn monorepo (yarn v1.22.22).
Steps to reproduce:

  1. Start a monorepo with npx create-turbo@latest select yarn as a package manager
  2. cd apps
  3. Ignite RN project npx ignite-cli@latest new pizza-app with following options:
Screenshot 2024-07-26 at 16 00 54
  1. cd pizza-app
  2. yarn install
  3. According to expo monorepo guidelines:
  • create index.js with the following content:
import { registerRootComponent } from "expo";

import App from "./App";

registerRootComponent(App);
  • update package.json (set "main": "index.js",)
  • update metro.config.js as in expo guidelines
  1. npx pod-install
  2. yarn ios
  3. 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
...

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
@mausic mausic added the bug label Jul 26, 2024
@mausic
Copy link
Author

mausic commented Jul 26, 2024

Tip

The issue is resolved if we Ignite the second RN app in the same monorepo.

Steps to reproduce:

  1. Take the codebase from original issue or sample repo
  2. cd apps
  3. npx ignite-cli@latest new dummy-app using the following options:
Screenshot 2024-07-26 at 16 20 19
  1. yarn install
  2. cd pizza-app
  3. npx pod-install
  4. yarn ios
  5. 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.

@frankcalise
Copy link
Contributor

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

@frankcalise frankcalise added this to the Ignite v10 milestone Aug 18, 2024
@fpena
Copy link
Collaborator

fpena commented Aug 18, 2024

Yes, we're working on a mono repo guide / recipe. It will be released alongside v10.

cc: @frankcalise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants