Daniel Loiterton
Daniel Loiterton

Reputation: 5306

Error setting up react-native-unimodules: Invalid `Podfile` file: cannot load such file

I'm following the expo docs to install react-native-unimodules in a plain react-native app. However the changes to my Podfile appear to break things when running pod install.

Here's the change that seems to be responsible. The first two lines of the Podfile were:

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

They're now changed to this:

require File.join(`node --print "require.resolve('react-native/package.json')"`, "../scripts/react_native_pods")
require File.join(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`, "../native_modules")
require File.join(`node --print "require.resolve('react-native-unimodules/package.json')"`, "../cocoapods.rb")

Which causes this error:

[!] Invalid `Podfile` file: cannot load such file -- /[myproject]/node_modules/react-native-unimodules/package.json
/../cocoapods.rb.

The file in question does appear to be in the correct location, so I'm not sure what the issue is?

Upvotes: 1

Views: 4614

Answers (1)

Daniel Loiterton
Daniel Loiterton

Reputation: 5306

I managed to solve this by reverting to the previous two lines, and adding:

require_relative '../node_modules/react-native-unimodules/cocoapods.rb'

Upvotes: 1

Related Questions