Closed SleeplessByte closed 1 year ago
I'm using yarn 1 so that must be why it works for me. I know that create-tamagui-app
uses yarn 3, so maybe we could follow the steps they took to upgrade the examples? Yarn 1 does work for what it's worth...
Unfortunately Yarn 1 is in maintenance mode so we'd love to get rid of that.
I went ahead and downgraded the local version:
rm -rf .yarn # will be regenerated automatically
rm -f .yarnrc.yml # will be regenerated as .yarnrc
yarn set version 1.22.1
yarn install
Now make sure you're in the next
app folder because the dir
passed to findPagesDir
in next
will be the workspace root.
cd apps/next
yarn next
It still complains about an invalid next.config.js
, but it works!
I think the problem is the peer dependencies, as listed above, so perhaps solving those for a blank next project, and blank expo project, and then combining then will solve it. Probably the quickest thing to try.
Interesting. For some reason I've had zero issues using Yarn 1 generally. I would prefer to upgrade this all to Yarn 3, since Yarn 1 is super slow. However, when I tried to do so in my real app's monorepo, basically everything went wrong lol. So I decided to stick with what I had for now...
Yarn plug'n'play (pnp), which is pretty central to Yarn 2/3, replaces node_modules with a .cache directory of zipped packages. There is a lot to like there (I was a dedicated Yarn PnP user for some time), but the lack of a node_modules folder can introduce a lot headaches. Especially relevant here, I think, is lack of compatibility with react-native with expo via metro.
Maybe a different issue, but I came to this thread for the next config errors mentioned by @SleeplessByte . I think the problematic options are being introduced somewhere in the withPlugins
business.
You'd have to use it without PnP, since React Native doesn't support it: https://yarnpkg.com/features/pnp#incompatible
Thanks :) Ah, and I just saw your response about the next config warnings here π
I see the Next.config.js issues with Yarn 1, so I think that's a separate issue. Here's how to reproduce the next.config.js
issues:
npx create-solito-app@latest next-config-issues -t with-expo-router
cd next-config-issues
yarn web
It's worth mentioning that there seem to be some versions that are out of date in the template. From the other issues, I've put together that one needs to go into apps/expo
and run expo-cli upgrade
(after installing expo-cli
globally with yarn add global expo-cli
). Possibly, it's necessary to update React (to 18.2.0) and Next (to latest, 13.x) as well.
That said, upgrading versions did not get rid of the next.config.js
errors for me.
I tried to debug Yarn 3 as well. Here's my attempt at a Yarn 3 reproduction:
npx create-solito-app@latest my-with-expo-router -t with-expo-router
cd my-with-expo-router
yarn set version stable
yarn -v
yarn
yarn web
That gives a "react-dom needs to be installed for Next.js warning" so I ran:
cd apps/next
yarn add react-dom
cd ..
yarn
yarn web
Unfortunately, that doesn't fix things. Here's where that ends up:
error - ../../node_modules/@expo/html-elements/build/css/units.js:1:0
Module not found: Can't resolve 'react-native'
Import trace for requested module:
../../node_modules/@expo/html-elements/build/elements/Headings.js
../../node_modules/@expo/html-elements/build/Elements.js
../../node_modules/@dripsy/core/build/components/H1.js
../../node_modules/@dripsy/core/build/components/index.js
../../node_modules/@dripsy/core/build/index.js
../../node_modules/dripsy/build/index.js
../../packages/app/provider/dripsy.tsx
../../packages/app/provider/index.tsx
./pages/_app.tsx
This is Yarn 3 "without PnP" (nodeLinker: node-modules
) since React Native doesn't support PnP.
I know the tamagui solito starter has yarn 3 working, we could probably port over those changes.
Thanks for the tip @nandorojo I can take a look.
npx create-solito-app@latest my-with-expo-router -t with-expo-router
cd my-with-expo-router
yarn set version stable
yarn -v
yarn
rm -rf yarn.lock
rm -rf node_modules
yarn
yarn -v
yarn web
yarn
(yarn install
) steps..yarnrc.yml
file that looks like:
yarnPath: .yarn/releases/yarn-3.4.1.cjs
nodeLinker: node-modules
.yarnrc.yml
file is created automatically when running the second yarn
(first of two runs with Yarn 3).@nandorojo How would you feel about a PR to add a page to the docs under Guides titled "Upgrade to Yarn 3"?
yeah that would work. I'm also open to a PR to migrate all the starters themselves if this works. I assume you tried both the native app and the website, right?
I'm working on upgrading examples, in addition to an upgrade guide. You can follow along here: https://github.com/nandorojo/solito/releases/tag/v3.1.0
Fixed in 3.1.0
Yarn 1 is deprecated and running yarn will now automatically upgrade to Yarn 3 using the node_modules linker, which should just work (according to Yarn), however it doesn't. I cannot figure out if this is a Yarn issue or a solito issue. One of my projects from earlier stopped working after running yarn install again.
The error message is the same as reported here: https://github.com/nandorojo/solito/issues/265#issuecomment-1358397434
Reproduction would be
Then run:
And finally go into the directory and run
yarn next
.This may also be a next option; I really can't tell from the errors, but it seems to be an underlying problem of next not being able to find
react-dom
at all.It could also be because peer dependencies are missing all over. These should really be listed in the projects:
When installing these into the project (cd next && yarn add react react-dom react-native-web react-native-gesture-handler), next does start, despite the "invalid config" error, but breaks on
error - ../../node_modules/@expo/html-elements/build/css/units.js
, probably because this dependencies needs to be higher.I don't quite understand how you have this working with Yarn at the moment.