react-native ios Podfile issue with “use_native_modules!”

前端 未结 18 1911
一生所求
一生所求 2020-12-05 17:15

In my react-native project (react-native@0.60) in the ios/ dir I run pod install and get this error:

[!] Invalid `Podfile` file: no implicit con         


        
相关标签:
18条回答
  • 2020-12-05 18:02

    I got this error after I tried to react-native run-ios an Expo app. The error I got indicated that something was wrong with the Pods, so I ran cd ios && pod install, which is how I got a similar error as the OP.

    In that case, you obviously need to expo start instead of react-native run-ios.

    0 讨论(0)
  • 2020-12-05 18:03

    If you are using

    pod install --project-directory=ios
    

    you might need to tweak the Podfile by replacing

    use_native_modules!

    to

    use_native_modules!(".")

    Maybe this behavior will be improved in the future, I opened an issue about it https://github.com/react-native-community/cli/issues/657

    0 讨论(0)
  • 2020-12-05 18:03

    For me, I deleted the node_modules and installed again by using npm install . After that, I navigated to /ios folder and ran pod install it worked.

    0 讨论(0)
  • 2020-12-05 18:06

    One of the reasons may be outdated version of Ruby. Use following command to upgrade it.

    rvm install 2.6.1
    rvm use 2.6.1 --default
    

    Or you can follow below article, which has a detailed explanation of upgrading ruby and associated gems.

    https://help.learn.co/en/articles/2789231-how-to-upgrade-from-ruby-2-3-to-2-6

    0 讨论(0)
  • 2020-12-05 18:07

    Ok, my guess is for most people, the accepted answer will fix their issue. For me, the fix was so bizarre, I had to add it here.

    For whatever reason, I ended up creating an invalid AndroidManifest.xml file in my android native setup.

    I looked at the full error output, and the first lines of the error referenced a line number and column number. At that point in my xml file I broke the xml formatting.

    2 days of searching to find a GitHub Issue with a description of where to look.

    0 讨论(0)
  • 2020-12-05 18:08

    this is because the outdate yarn version on your device, if you on macOS you can upgrade/install the yarn with follow this link: here it is

    be aware to delete node-module and yarn.lock file, install all packages again, navigate to ios folder and run pod install.

    0 讨论(0)
提交回复
热议问题