Invalid Podfile: pod install fails with use_native_modules!

See original GitHub issue

pod install fails when I use the boilerplate Podfile which calls for use_native_modules!. It gives me the strange error:

[!] Invalid `Podfile` file: 767: unexpected token at 'Error: Unexpected close tag

Line: 25

Column: 18

Char: >

Without this my native modules are not properly installing.

React Native version:

System:
    OS: macOS 10.15.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 1.48 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.12.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.2/11B52 - /usr/bin/xcodebuild

Steps To Reproduce

  1. Upgrade from RN 0.59.9 to RN 0.61.4
  2. Use boilerplate Podfile - https://raw.githubusercontent.com/react-native-community/rn-diff-purge/release/0.61.1/RnDiffApp/ios/Podfile
  3. Do a pod repo update and then a pod install

Describe what you expected to happen:

It should install Pods per the Podfile as well as ‘use_native_modules!’

What happens when I run pod install --verbose:


error Unexpected close tag
Line: 25
Column: 18
Char: >. Run CLI with --verbose flag for more details.

[!] Invalid `Podfile` file: 767: unexpected token at 'Error: Unexpected close tag

Line: 25

Column: 18

Char: >

    at error (/my/project/path/node_modules/sax/lib/sax.js:651:10)

    at strictFail (/my/project/path//node_modules/sax/lib/sax.js:677:7)

    at closeTag (/my/project/path/node_modules/sax/lib/sax.js:871:9)

    at SAXParser.write (/my/project/path/node_modules/sax/lib/sax.js:1436:13)

    at new XmlDocument (/my/project/path/node_modules/xmldoc/lib/xmldoc.js:261:15)

    at readManifest (/my/project/path/node_modules/@react-native-community/cli-platform-android/build/config/readManifest.js:38:10)

    at Object.projectConfig (/my/project/path/node_modules/@react-native-community/cli-platform-android/build/config/index.js:59:46)

    at Object.get project [as project] (/my/project/path/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/config/index.js:136:50)

    at /my/project/path/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:8:452

    at Array.forEach (<anonymous>)
'.

 #  from /my/project/path/ios/Podfile:46
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:301:in `rescue in block in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:295:in `block in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:50:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:293:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:293:in `from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/podfile.rb:259:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/config.rb:200:in `podfile'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:150:in `verify_podfile_exists!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:46:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Snack, code example, screenshot, or link to a repository:

My podfile:

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

target 'MyApp' do
  # Pods for MyApp
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # pod 'RNFS', :path => '../node_modules/react-native-fs'
  # pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  # pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'MyApp-tvOS' do
  # Pods for MyApp-tvOS

  target 'MyApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

40reactions
thymikeecommented, Nov 15, 2019

There’s a syntax error in your AndroidManifest.xml. You’ll need to fix it. Here’s a reference: https://github.com/react-native-community/cli/issues/846

2reactions
a-tokyocommented, Jan 29, 2020

My issue was that I had react-native-cli as a dependency, Everything worked fine once I removed it and the error didn’t show up again. Hope somebody might find this useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native ios Podfile issue with "use_native_modules!"
The error I got indicated that something was wrong with the Pods, so I ran cd ios && pod install , which is...
Read more >
React Native 0.60 use_native_modules! - CircleCI Discuss
... however I consistently run into the following issue when running bundle exec pod install --verbose: Invalid `Podfile` fil…
Read more >
react-native ios Podfile issue with "use_native_modules!"
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...
Read more >
Pod install error : r/iOSProgramming - Reddit
I am creating a react native app using expo and am running into the following error when running pod install (on windows):. [!]...
Read more >
How to fix “pod install” error in React Native on Mac M1
to install cocoapods , the standard dependency manager for Swift and Objective-C projects. I also assume you have created your app with a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found