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

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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?

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

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! 🤞

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.

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.

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

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.

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