react-native-screens: Invalid `RNScreens.podspec` file: undefined method `install_modules_dependencies' for module Pod.

Description

Getting below error during pod installation:

[!] Invalid Podfile file: [!] Invalid RNScreens.podspec file: undefined method `install_modules_dependencies’ for module Pod.

from /Users/mac/mobileApp/node_modules/react-native-screens/RNScreens.podspec:25

-------------------------------------------

install_modules_dependencies(s)

if new_arch_enabled

-------------------------------------------

.

from /Users/mac/mobileApp/ios/Podfile:9

-------------------------------------------

target ‘mobileApp’ do

config = use_native_modules!

-------------------------------------------

Steps to reproduce

Below is the package.json file { “name”: “mobileApp”, “version”: “0.0.1”, “private”: true, “scripts”: { “postinstall”: “patch-package”, “android”: “react-native run-android”, “ios”: “react-native run-ios”, “start”: “react-native start”, “test”: “jest”, “lint”: “eslint .” }, “dependencies”: { “@ptomasroos/react-native-multi-slider”: “^2.2.2”, “@react-native-community/checkbox”: “^0.5.17”, “@react-native-community/clipboard”: “^1.5.1”, “@react-native-community/netinfo”: “^11.3.1”, “@react-navigation/bottom-tabs”: “^6.5.19”, “@react-navigation/drawer”: “^6.6.15”, “@react-navigation/native”: “^6.1.16”, “@react-navigation/native-stack”: “^6.9.25”, “@shopify/flash-list”: “^1.7.0”, “@turf/helpers”: “^7.0.0”, “@twotalltotems/react-native-otp-input”: “^1.3.11”, “axios”: “^1.7.2”, “lodash”: “^4.17.21”, “mappls-map-react-native”: “^1.0.8”, “moment”: “^2.30.1”, “patch-package”: “^8.0.0”, “qs”: “^6.12.3”, “react”: “18.1.0”, “react-native”: “0.70.0”, “react-native-actions-sheet”: “0.9.6”, “react-native-blob-util”: “^0.19.9”, “react-native-check-box”: “^2.1.7”, “react-native-date-picker”: “^4.4.2”, “react-native-dropdown-picker”: “^5.4.6”, “react-native-elements”: “^3.4.3”, “react-native-fast-image”: “^8.6.3”, “react-native-gesture-handler”: “^2.16.0”, “react-native-htmlview”: “^0.17.0”, “react-native-image-picker”: “^7.1.2”, “react-native-keyboard-aware-scroll-view”: “^0.9.5”, “react-native-keychain”: “^8.2.0”, “react-native-linear-gradient”: “^2.8.3”, “react-native-localization”: “^2.3.2”, “react-native-maps”: “^1.15.4”, “react-native-pager-view”: “^6.3.3”, “react-native-paper”: “^5.12.3”, “react-native-popup-dialog”: “^0.18.3”, “react-native-reanimated”: “^2.14.1”, “react-native-safe-area-context”: “^4.9.0”, “react-native-screens”: “^3.30.0”, “react-native-snap-carousel”: “^3.9.1”, “react-native-splash-screen”: “^3.3.0”, “react-native-star-rating-widget”: “^1.7.3”, “react-native-svg”: “12.1.0”, “react-native-tab-view”: “^3.5.2”, “react-native-vector-icons”: “^10.1.0”, “react-native-webview”: “^13.10.5”, “react-redux”: “^7.2.0”, “redux”: “^4.0.5”, “redux-devtools-extension”: “^2.13.9”, “redux-logger”: “^3.0.6”, “redux-persist”: “5.6.12”, “redux-persist-filesystem-storage”: “^3.0.0”, “redux-thunk”: “^2.4.2”, “rn-fetch-blob”: “^0.12.0”, “validate.js”: “^0.13.1” }, “devDependencies”: { “@babel/core”: “^7.12.9”, “@babel/runtime”: “^7.12.5”, “@react-native-community/eslint-config”: “^2.0.0”, “babel-jest”: “^26.6.3”, “eslint”: “^7.32.0”, “jest”: “^26.6.3”, “metro-react-native-babel-preset”: “^0.72.1”, “react-test-renderer”: “18.1.0” }, “jest”: { “preset”: “react-native” } }

The same dependancies in another application with react native version 0.74.5, works fine. But upgrading the react native version is not possible at this point. Need to figure out what is the issue

Snack or a link to a repository

https://github.com/Sushmitha-BS25/RNScreens-issue

Screens version

3.30.0

React Native version

0.70.0

Platforms

iOS

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

None

Device model

No response

Acknowledgements

Yes

About this issue

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

Most upvoted comments

i removed (^) from “react-native-screens”: “^3.29.0” and worked

I fixed the issue by strictly using react-native-screens v3.25.0

I’m facing the exact same issue. Have you found any solution yet?

i have fixed this issue node_modules/react-native-screens/RNScreens.podspec file commented

install_modules_dependencies(s) – line no 25

What is the RCA of this issue?

install_modules_dependencies is only available from RN 0.71+. If your RN version is older than that you’d get this error. Thus, whoever with this issue you could either;

  1. Update RN to > 0.71+
  2. Downgrade the version of this package to compatible one

I’m still getting the same error:

Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file:
[!] Invalid `RNScreens.podspec` file: undefined method `project_header_files=' for #<Pod::Specification name="RNScreens">.

 #  from /Users/username/projects/../node_modules/react-native-screens/RNScreens.podspec:22
 #  -------------------------------------------
 #    s.source_files = source_files
 >    s.project_header_files = "cpp/**/*.h" # Don't expose C++ headers publicly to allow importing framework into Swift files
 #    s.requires_arc = true
 #  -------------------------------------------
.

 #  from /Users/username/projects/../ios/Podfile:40
 #  -------------------------------------------
 #  # @generated end react-native-maps
 >    config = use_native_modules!(config_command)
 #
 #  -------------------------------------------

pod install --repo-update --ansi exited with non-zero code: 1

I would appreciate any help with fixing it

    "react-native": "0.76.2",
    "expo": "^52.0.7",

@alex-mironov I had an issue with cocoapods 1.10.2 version, then I migrated to 1.16.2 and issue was fixed

I’m still getting the same error:

Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file:
[!] Invalid `RNScreens.podspec` file: undefined method `project_header_files=' for #<Pod::Specification name="RNScreens">.

 #  from /Users/username/projects/../node_modules/react-native-screens/RNScreens.podspec:22
 #  -------------------------------------------
 #    s.source_files = source_files
 >    s.project_header_files = "cpp/**/*.h" # Don't expose C++ headers publicly to allow importing framework into Swift files
 #    s.requires_arc = true
 #  -------------------------------------------
.

 #  from /Users/username/projects/../ios/Podfile:40
 #  -------------------------------------------
 #  # @generated end react-native-maps
 >    config = use_native_modules!(config_command)
 #
 #  -------------------------------------------

pod install --repo-update --ansi exited with non-zero code: 1

I would appreciate any help with fixing it

    "react-native": "0.76.2",
    "expo": "^52.0.7",

@ricardopetrere there are few reasons why we won’t go for setting peerDependencies, but the main and deciding one is: there are different sets of supported react-native versions depending on react-native architecture the application is using, thus single “minimum supported react-native version” does simply not exist. However, we do acknowledge the problem of you (library user) having to check with every upgrade for changes in supported RN versions. Most likely we will go in direction of having clear & strict policy of what versions of RN are supported (e.g. three/four most recent ones), but we still need to discuss this internally.

I’m closing the issue, as it arises from mismatch between the library version & react-native version.

For everyone encountering this error: please refer to the readme for the list of supported react-native versions for given react-native-screens library version.

I fixed the issue by strictly using react-native-screens v3.25.0

Thank you. This works