question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False positive "Multiple versions of Reanimated" because of local .yarn cache in 2.10.0

See original GitHub issue

Description

Hi, I’m getting an error Multiple versions of Reanimated were detected on my gitlab runner environment. I’m using local .yarn cache in the root of the project.

iOS:

[!] Invalid `Podfile` file: 
[!] Invalid `RNReanimated.podspec` file: [Reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected 

Conflict between: 
- /.yarn/v6/npm-react-native-reanimated-2.10.0-ed53be66bbb553b5b5e93e93ef4217c87b8c73db-integrity/node_modules/react-native-reanimated
- /node_modules/react-native-reanimated
.

Android:

* What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.
> 
  Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected 
  
  Conflict between: 
  - /.yarn/v6/npm-react-native-reanimated-2.10.0-ed53be66bbb553b5b5e93e93ef4217c87b8c73db-integrity/node_modules/react-native-reanimated
  - /node_modules/react-native-reanimated
  


My project, however, resolves to 2.10.0 only:

yarn why v1.22.19
[1/4] 🤔  Why do we have the module "react-native-reanimated"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "react-native-reanimated@2.10.0"
info Has been hoisted to "react-native-reanimated"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "27.16MB"
info Disk size with unique dependencies: "27.36MB"
info Disk size with transitive dependencies: "32.86MB"
info Number of shared dependencies: 40
✨  Done in 0.32s.

Shouldn’t the yarn/npm cache be excluded from the duplicities check? Or maybe it should search only in the scope of the root node_modules ?

Steps to reproduce

iOS

  1. have a project with one installation of rn-reanimated of 2.10.0
  2. rm -rf node_modules
  3. yarn install --cache-folder .yarn
  4. cd ios
  5. pod install
  6. error ❌

Android

  1. have a project with one installation of rn-reanimated of 2.10.0
  2. rm -rf node_modules
  3. yarn install --cache-folder .yarn
  4. react-native run-android
  5. error ❌

Snack or a link to a repository

🤷‍♂️

Reanimated version

2.10.0

React Native version

0.69.4

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

No response

Device

No response

Device model

No response

Acknowledgements

Yes

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
mjoomscommented, Aug 23, 2022

Works!

I noticed the PR is based on 3.0.0-rc.2. So I verified 3.0.0-rc.2 also gave the error. It does.

Specifying your PR:

    "react-native-reanimated": "https://github.com/software-mansion/react-native-reanimated#874792921f64f526899fad9c39b168458813570b",

makes pod install behave again.

2reactions
tomekzawcommented, Aug 23, 2022

Should we use the custom PR link until the official patch is published?

Sure, go ahead, but note that the PR is based on 3.0.0-rc.2.

If you use Reanimated 2.x, I recommend using patch-package (at least until we backport this PR to the 2.x branch).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common problems | React Native Reanimated
Multiple versions of Reanimated were detected​ ... This error usually happens when in your project there exists more than one instance of Reanimated....
Read more >
Configuration options | Yarn - Package Manager
The cache is deemed to be relatively safe to be shared by multiple projects, even when multiple Yarn instances run at the same...
Read more >
react-native-reanimated: Versions - Openbase
Full version history for react-native-reanimated including change logs. ... false positive "Multiple versions of Reanimated" because of local .yarn cache by ...
Read more >
React Native Reanimated Versions - Open Source Agenda
View the latest React Native Reanimated versions. ... 2 weeks ago ... Fix false positive "Multiple versions of Reanimated" because of local .yarn...
Read more >
Requiring module "node_modules\react-native-reanimated ...
js", which threw an exception: Error: Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin? In babel....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found