React-native: Invalid Podfile on Appcenter

Created on 22 Aug 2019  路  14Comments  路  Source: facebook/react-native

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(R) Core(TM) 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

Bug

Most helpful comment

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.

All 14 comments

Same problem.

Nevermind, I've configured Appcenter wrong.
Instead of choosing the React Native configuration, I chose Object C and Swift 馃う鈥嶁檪

Answering anything and closing the issue wont help!

For me, it is clear enough that it wasn't a React Native bug, but a mistake of mine.

So if you got this error on Appcenter, make sure you've configured right the settings, in my case I choose Object C and Swift, which is obviously wrong.

If you're getting this error in another context, please open another issue.
Because I haven't faced this error again.

install yarn in terminall

I face it

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.

The issue usually appears when missing the react-native dependency. So ensure that you don't mistakenly delete react-native in your package.json

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

Same problem on AppCenter. That's how I found this issue.

I found a solution to my problem.
I have a monorepo architecture. And the yarn.lock file is located at the root.
So when I was selecting mobile-app/package.json in the AppCenter UI, the bot was looking for yarn.lock that didn't exist. So I created an empty yarn.lock file in the mobile-app/ folder

And now, I have an other issue (android can build now) on iOS:

Error: Cannot find module '/Users/runner/runners/2.165.0/work/1/s/mobile-app/node_modules/react-native/local-cli/cli.js'

It's looking for mobile-app/node_modulesbut it should be /node_modules ...

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"

Do
1: npm i
2: react-native link (if any)
3: cs ios && pod install && cd ..

Was this page helpful?
0 / 5 - 0 ratings