react-native: Invalid Podfile on Appcenter

I’m taking the following error on pod install:

[!] Invalid `Podfile` file: cannot load such file -- /node_modules/@react-native-community/cli-platform-ios/native_modules.

 #  from /ios/Podfile:2
 #  -------------------------------------------
 #  platform :ios, '9.0'
 >  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
 #  

React Native version:

System: OS: macOS 10.14.6 CPU: (4) x64 Intel® Core™ i5-7360U CPU @ 2.30GHz Memory: 275.30 MB / 8.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 10.16.0 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 IDEs: Android Studio: 3.4 AI-183.6156.11.34.5692245 Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmGlobalPackages: react-native-cli: 2.0.1

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 18

Most upvoted comments

I had the same error, and it was because I had not installed node dependencies and it was not able to find them at line:

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

I just ran npm i in project root and the error went away.

Nevermind, I’ve configured Appcenter wrong. Instead of choosing the React Native configuration, I chose Object C and Swift 🤦‍♂

install yarn in terminall

Answering anything and closing the issue wont help!

I am also facing this issue but npm i did not solve the issue. This issue happens only on App Center and local build just works fine.

[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.8.4
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod install --repo-update

[!] Invalid `Podfile` file: cannot load such file -- /Users/runner/runners/2.165.0/work/1/s/storybookApp/node_modules/@react-native-community/cli-platform-ios/native_modules.

 #  from /Users/runner/runners/2.165.0/work/1/s/storybookApp/ios/Podfile:2
 #  -------------------------------------------
 #  platform :ios, '9.0'
 >  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
 #  
 #  -------------------------------------------
##[error]The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[section]Finishing: Pod install
##[section]Starting: Xcode build (signed)

Any one else is also facing the issue

Looks like I faced this problem cuz I switched my internet when npm install was preforming its job as it didn’t installed some packages properly.

So deleting the node_modules folder and then used npm install in root to create it again worked for me.

Hello @Daavidaviid, I’m using a monorepo architecture as well. repo-name/react-native-mobile. I solved the “can not load such file” issue by modifying the require_relative path in ios/Podfile to

# it was "../node_modeuls/@react-native-community/... before"
require_relative "../../node_modules/@react-native-community/cli-platform-ios/native_modules"

I face it

Same problem.