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

4.4k Views Asked by At

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?

1

There are 1 best solutions below

0
On

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

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