React-native: Invalid Podfile: pod install fails with use_native_modules!

Created on 13 Nov 2019  路  6Comments  路  Source: facebook/react-native

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
Bug

Most helpful comment

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

All 6 comments

Also get a very similar error when running pod install->

error No whitespace between attributes
Line: 14
Column: 53
Char: a. Run CLI with --verbose flag for more details.

[!] Invalid `Podfile` file: 767: unexpected token at 'Error: No whitespace between attributes

Line: 14

Column: 53

Char: a

    at error (/projectFolder/node_modules/sax/lib/sax.js:651:10)

    at strictFail (/projectFolder/node_modules/sax/lib/sax.js:677:7)

    at SAXParser.write (/projectFolder/node_modules/sax/lib/sax.js:1395:13)

    at new XmlDocument (/projectFolder/node_modules/xmldoc/lib/xmldoc.js:261:15)

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

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

    at Object.get project [as project] (/projectFolder/node_modules/@react-native-community/cli/build/tools/config/index.js:134:65)

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

    at Array.forEach (<anonymous>)

    at _objectSpread (/projectFolder/node_modules/@react-native-community/cli/build/commands/config/config.js:8:392)
'.

 #  from /projectFolder/ios/Podfile:45
 #  -------------------------------------------
 #
 >    use_native_modules!
 #  end
 #  -------------------------------------------

React versions:

@react-native-community/cli: ^2.9.0 => 2.9.0 
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4

Please advise

Does anyone have any insight? I'm still stuck on this issue and it's keeping me from upgrading to RN 60.

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

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.

cd react-native-starter && yarn install you made sure you installed it right

Got the same error here ... waiting form some solution

Was this page helpful?
0 / 5 - 0 ratings