software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.85k stars 1.29k forks source link

Invalid `RNReanimated.podspec` file: no implicit conversion of nil into Array. IOS when updating from reanimated 2.8.0 to 2.12.0 #3754

Closed FrozenPyrozen closed 1 year ago

FrozenPyrozen commented 1 year ago

Description

When update reanimated from 2.8.0 to 2.12.0 got error when installing pods, also update to reanimated 2.9.0 gives the same error:

`npx pod-install`
Scanning for pods...
1.11.3
> pod install

[!] Invalid `Podfile` file: 
[!] Invalid `RNReanimated.podspec` file: no implicit conversion of nil into Array.

 #  from /Users/admin/Projects/test_project/node_modules/react-native-reanimated/RNReanimated.podspec:6
 #  -------------------------------------------
 #  config = find_config()
 >  assert_no_multiple_instances(config)
 #  assert_no_reanimated2_with_new_architecture(reanimated_package_json)
 #  -------------------------------------------
.

 #  from /Users/admin/Projects/test_project/ios/Podfile:8
 #  -------------------------------------------
 #  target 'MobileWebWallet' do
 >    config = use_native_modules!
 #  
 #  -------------------------------------------
Couldn't install Pods. Updating the Pods project and trying again...
> pod install --repo-update

[!] Invalid `Podfile` file: 
[!] Invalid `RNReanimated.podspec` file: no implicit conversion of nil into Array.

 #  from /Users/admin/Projects/test_project/node_modules/react-native-reanimated/RNReanimated.podspec:6
 #  -------------------------------------------
 #  config = find_config()
 >  assert_no_multiple_instances(config)
 #  assert_no_reanimated2_with_new_architecture(reanimated_package_json)
 #  -------------------------------------------
.

 #  from /Users/admin/Projects/test_projectt/ios/Podfile:8
 #  -------------------------------------------
 #  target 'MobileWebWallet' do
 >    config = use_native_modules!
 #  
 #  -------------------------------------------
Couldn't install Pods. Updating the Pods project and trying again...
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file: 
[!] Invalid `RNReanimated.podspec` file: no implicit conversion of nil into Array.

 #  from /Users/admin/Projects/test_project/node_modules/react-native-reanimated/RNReanimated.podspec:6
 #  -------------------------------------------
 #  config = find_config()
 >  assert_no_multiple_instances(config)
 #  assert_no_reanimated2_with_new_architecture(reanimated_package_json)
 #  -------------------------------------------
.

 #  from /Users/admin/Projects/test_project/ios/Podfile:8
 #  -------------------------------------------
 #  target 'MobileWebWallet' do
 >    config = use_native_modules!
 #  
 #  -------------------------------------------

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to reproduce

  1. Got "react-native-reanimated": "^2.8.0",
  2. Update "react-native-reanimated": "^2.12.0",

Snack or a link to a repository

no link

Reanimated version

2.8.0

React Native version

0.69.4

Platforms

iOS

JavaScript runtime

JSC

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 1 year ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

VihangaAW commented 1 year ago

I am also getting this error when I tried to update from 2.10.0 to 2.12.0 I had to update due to #3743, now Android app builds without any errors but pod install fails

rahul26496 commented 1 year ago

I am also facing same issue today, yesterday it was working fine.

lorenzomilesi commented 1 year ago

Same problem here. What I tried:

pod deintegrate
pod repo update
pod install

I also deleted Podfile.lock with no luck.

ibrahimmemonn commented 1 year ago

For those using RBENV for managing ruby versions, whenever you install a different ruby version and then you'll be faced with the following error(not 100% same lol):

gem update --system
bundle update --bundler

Both these commands will be helpful in fixing the issue.

scanifydevo commented 1 year ago

It took me hours but in my case, the issue was having space in the project name.
i.e ABC Project Changing that to ABCProject worked for me. I know it's a bit weird, but this worked for me twice.

munsifhayat commented 1 year ago

It took me hours but in my case, the issue was having space in the project name. i.e ABC Project Changing that to ABCProject worked for me. I know it's a bit weird, but this worked for me twice.

jfkm69 commented 1 year ago

Looks like the problem lies here (https://github.com/software-mansion/react-native-reanimated/blob/05c93b02ede93950904812239fbe95366e372ab6/scripts/reanimated_utils.rb#L63), its possible that we can have multiple instances of react-native-reanimated in the same node_modules directory. Suggested fix is here: https://github.com/software-mansion/react-native-reanimated/pull/3774

ali-husnain commented 1 year ago

Anyone please help me after upgrading expo sdk 46 to 47 with react-native-reanimated 2.12.0 my ios build failed. Also having this

"expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
  }

image

AbdulmalekAlshugaa commented 1 year ago

Hi guys, anyone still face this issue, please advise , almost one day without lack to fix it up

SamithaMaddekanda commented 1 year ago

Invalid Podfile file: Invalid RNReanimated.podspec file: different prefix: "" while trying to do pod install

reanimated_package_json = JSON.parse(File.read(File.join(dir, "package.json")))

config = find_config()

assert_no_multiple_instances(config)

Currently using react-native-reanimated "^2.13.0" (latest)

Did anybody get this issue?

rohit1345 commented 1 year ago

Invalid Podfile file: Invalid RNReanimated.podspec file: different prefix: "" while trying to do pod install

reanimated_package_json = JSON.parse(File.read(File.join(dir, "package.json")))

config = find_config()

assert_no_multiple_instances(config)

Currently using react-native-reanimated "^2.13.0" (latest)

Did anybody get this issue?

i'm also facing same issue.

jfkm69 commented 1 year ago

The issue you are facing is occurs when you have multiple instances of RNAnimated (https://docs.swmansion.com/react-native-reanimated/docs/next/fundamentals/troubleshooting/#multiple-versions-of-reanimated-were-detected) and it has been described here (https://github.com/software-mansion/react-native-reanimated/pull/3774). TLDR; there's a problem with the assert_no_multiple_instances function in this file (https://github.com/software-mansion/react-native-reanimated/blob/05c93b02ede93950904812239fbe95366e372ab6/scripts/reanimated_utils.rb). The fix is available in this release (https://github.com/software-mansion/react-native-reanimated/releases/tag/3.0.0-rc.7) but its still a pre-release candidate so I'm not sure how stable it is to use in production code. You can always just apply the changes in this PR (https://github.com/software-mansion/react-native-reanimated/pull/3774) to your node_modules folder and persist them using patch-package or something similar.

vizsatiz commented 1 year ago

@jfkm69 This worked for me, lots of thanks. But now I have to wait for a stable version of the lib.

I did the patch-package fix and latest rc version was giving me other issues

rumzledz commented 1 year ago

Hi all 👋 I have managed to fix this issue on my machine by doing the following:

  1. brew uninstall cocoapods
  2. gem install cocoapods -v 1.10.1 (I'm using rbenv to manage my Ruby versions by the way)
  3. Navigate to the ios directory
  4. pod install

Hope someone else finds this useful! 🤞

rhkdgns95 commented 1 year ago

@jfkm69 thank you i solved it thanks to you!

piaskowyk commented 1 year ago

Should be fixed in 2.14.0 and in 3.0.0-rc.10

Aaron5277 commented 1 year ago

Should be fixed in 2.14.0 and in 3.0.0-rc.10

That's works for me , 2.12.0 => 2.14.0.

codekojo commented 1 year ago

Check if you have spaces in your path.

Example: /Users/me/Documents/Github/Sample Project/reactnativeproject

peedrogaabriiel commented 9 months ago

I am also getting this error when I tried to update from 2.10.0 to 2.12.0 I had to update due to #3743, now Android app builds without any errors but pod install fails

Thank so much, you helped me!