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

Hoisting react-native-reanimated causes the app to quite with duplicates error #81

Open
kickbk opened this issue Jan 27, 2023 · 4 comments

Comments

@kickbk
Copy link

kickbk commented Jan 27, 2023

If you add "react-native-reanimated": "~2.12.0" to dependencies in apps/mobile and in packages/feature-home, then react-native-reanimated will be installed inside node_modules of apps/mobile and in the root, but not in packages/feature-home.

I'm not entirely sure if this is intended. I thought when the versions match it will be hoisted to the root node_modules and should not install in apps/mobile?

Regardless, when you then build the app and install it, then try to run it, it will crash during the splash screen and complain about multiple versions of react-native-reanimated.

This is true for several other packages.

Interestingly enough, if you add "react-native-elements": "^4.0.0-rc.2" for instance to dependencies of both apps/mobile and packages/feature-home, then that package will not be installed in apps/mobile and only in the root.

So if this is how hoisting is supposed to work, then it doesn't work for all packages. Not sure why not.

@rrebase
Copy link

rrebase commented Feb 17, 2023

I've struggled with the same issue and nohoist options aren't working in pnpm if using node-linker=hoisted (pnpm/pnpm#5651)

@kickbk
Copy link
Author

kickbk commented Feb 21, 2023

I've struggled with the same issue and nohoist options aren't working in pnpm if using node-linker=hoisted (pnpm/pnpm#5651)

Actually, we worked on that node-linker=hoisted issue and it's resolved. Just update pnpm.
I'm still facing the issue where hoisted packages end up getting installed in apps and packages instead of the root resulting in multiple versions. I just moved all dependencies to the apps, which works, but it kinda beats the purpose of hoisting.

@rrebase
Copy link

rrebase commented Feb 27, 2023

Actually, we worked on that node-linker=hoisted issue and it's resolved. Just update pnpm.

Can you link to the exact change/version that resolved it? 🙏 I can't seem to find any fixes related to this

@kickbk
Copy link
Author

kickbk commented Feb 27, 2023

I'm using pnpm 7.26.3 and it works. However, unless installing the packages stalls for you, it's actually working. If it completed the installation and you're not seeing packages you expect to be hoisted get hoisted, then you're not alone ;) I ended up moving most packages to the app package.json.

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

No branches or pull requests

2 participants