infinitered / ignite

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
MIT License
17.69k stars 1.4k forks source link

"Unable to resolve module: none of these files exist: [path]/AppEntry" #2796

Open 0-CAT opened 1 month ago

0-CAT commented 1 month ago

Describe the bug

I am starting a fresh React Native project based on the documentation here and here.

In an existing repository using PNPM & Turbo, I created a new project in [root]/apps/client using npx ignite-cli@latest new [PROJECTNAME] using bare React Native. All of the setup worked without errors.

When I run pnpm ios, it seems to work; there are no errors in my terminal window. However, I get an error in the emulator itself (shown in the first image below) stating "Unable to resolve module" and telling me that "None of these files exist" when looking for [PROJECT_ROOT]/node_modules/.pnpm/expo@51.0.36_@babel+core@7.25.7_@babel+preset-env@7.25.7_@babel+core@7.25.7_/node_modules/expo. However, I checked, and this file does exist (shown in the second image below).

It looks like #2334 had a similar issue in the past and said that PNPM might be the issue. However, I'm stuck with PNPM as this has to integrate into an existing repository so that we can reuse some internal data contract & business logic packages. Is this a bug with Ignite's handling of PNPM-based repositories?

Images

CleanShot 2024-10-05 at 16 10 03

CleanShot 2024-10-05 at 16 11 32

Ignite version

9.10.1

Additional info

It looks like there's an issue running this command when you're using PNPM as the package manager. The below output is all I get (worth noting that I have "packageManager": "pnpm@9.6.0" in my root-level package.json):

System
  platform           darwin
  arch               arm64
  cpu                10 cores     Apple M2 Pro
  directory          client       /Users/[USERNAME]/Code/[PROJECTNAME]/apps/client

/Users/[USERNAME]/.npm/_npx/e31027f3785124a8/node_modules/gluegun/build/index.js:15
    throw up;
    ^
error This project's package.json defines "packageManager": "yarn@pnpm@9.6.0". However the current global version of Yarn is 1.22.22.
frankcalise commented 1 month ago

Hi @0-CAT - there are already open issues where we are trying to document proper monorepo set up such as #1981 #2715

You can view the in-progress documentation here: https://github.com/infinitered/ignite-cookbook/pull/173 - although it doesn't specifically address pnpm at this time, but maybe there is some information that could help unblock you and you could add to it.

~However, it looks as if your packageManager field inside of package.json is invalid. It should either be yarn@x.y.z or pnpm@x.y.z but not have both concatenated together as far as I know.~

(edit: disregard this above, I saw your note about that point)

If you could provide a minimal repository that reproduces the issue, would be happy to look at it further.

0-CAT commented 1 month ago

Thanks for the tips! Taking a look at those docs today.

I think I've unblocked myself for now by using the @rnx packages which have symlink resolvers—but unfortunately doing so required going with a different boilerplate than Ignite 😔. That said, if I get a moment I will definitely try and throw together a minimal repro!