React-Native iOS Podfile Issue with "Use_Native_Modules!"

react-native ios Podfile issue with use_native_modules!

Here is the correct answer:

1 - Your POD File should contain this line on top

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

2 - Make sure your package.json and node_module folders has this module installed

cli-platform-ios/native_modules

3 - If you didn't find after you run yarn install - means you have old cache node_modules in your machine and you need to clean it before reinstalling the package again.

4 - Clean cache yarn cache clean

5 - Make sure you have this file react-native.config.js and its configuration is VALID - and it doesn't have non-existing NPM packages - this step is LAST AND MOSTLY THE CAUSE of the error

Example of my react-native.config.js

module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./assets/fonts/'],
dependencies: {}, // make sure this dependencies are all valid installed packages or empty if you don't need it
};

6 - Install node packages yarn install and your pods should work now! pod install --repo-update

HAPPY coding!

Reactnative pod installe error Invalid `Podfile` file: undefined method `get_default_flags' for #Pod::Podfile...

for everyone who face this problem, just update react-native in package.json to ^0.68.0

React Native invalid podfile No such file or directory - ./node_modules/.bin/react-native.

I'm able to workaround this by creating a symlink to my node_modules in the folder containing the folder containing my Podfile (sorry for the wordiness!). In my case, I have an non-standard setup which looks like:

  projectFolder/
Podfile
app.xcworkspace
...
rn/
package.json
node_modules/
yarn.lock
ios --> symlink to projectFolder/
...

And my hacky workaround is to do this:

    parentFolder/
node_modules --> symlink to projectFolder/rn/node_modules
projectFolder/
... (all the stuff from above) ...

There must be a better way. (In my case, perhaps just follow the standard setup!)

undefined method `use_unimodules!' when installing react-native-unimodules

the installation of react-native-unimodules require the use of its own cocoapods. the use_unimodules! will be defined if you add this line below into the third line of your Podfile.

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

pod install failed on macOS Big sur

Seems it's related to Ruby ffi. Run the following commands:

  • sudo arch -x86_64 gem install ffi
  • arch -x86_64 pod install


Related Topics



Leave a reply



Submit