Pod install failing for react-native app (NoMethodError - undefined method `basename' for #<String:0x00007f81f0e20530>)

1.4k Views Asked by At

Pod install in ios folder of react-native app fails with the following error:

The exact same repository when cloned on a different machine installs all pods without any issue. I am deleting my node_modules and Pods/ and then running npm install followed by pod install. It gives the same error every time.

admins-MacBook-Pro-2:ios sourobratasarkar$ pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command


/usr/local/bin/pod install


### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack


   CocoaPods : 1.8.4
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : 10.2.1 (10E1001)
         Git : git version 2.20.1 (Apple Git-117)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ cdf100a5aa8dd2464e1c89ecb8609cf2c4d01cb5
               trunk - CDN - https://cdn.cocoapods.org/


### Plugins


cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0


### Podfile

ruby
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

node_modules_path = '../node_modules'
react_path = File.join(node_modules_path, 'react-native')
rnnearbee_spec_path = File.join(node_modules_path, 'react-native-nearbee/RNNearBee.podspec')
yoga_path = File.join(react_path, 'ReactCommon/yoga')
folly_spec_path = File.join(react_path, 'third-party-podspecs/Folly.podspec')
glog_spec_path = File.join(react_path, 'third-party-podspecs/glog.podspec')
double_conversion_spec_path = File.join(react_path, 'third-party-podspecs/DoubleConversion.podspec')

target 'sample_app' do
  inherit! :search_paths

  pod 'NearBee'
  # We want extra developer support in React inside this app
  pod 'React', :path => react_path, :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # Needed for debugging
    'RCTAnimation',
  ]

  # We're letting CP know where it can find these Podspecs
  pod 'yoga', :path => yoga_path
  pod 'Folly', :podspec => folly_spec_path
  pod 'DoubleConversion', :podspec => double_conversion_spec_path
  pod 'glog', :podspec => glog_spec_path

  pod 'RNNearBee', :path => '../node_modules/react-native-nearbee'

  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions-ble-fix'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  pod 'RNNearbee', :path => '../node_modules/react-native-nearbee'

end


### Error


NoMethodError - undefined method `basename' for #<String:0x00007f81f0e20530>
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:807:in `rescue in _eval_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:799:in `_eval_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:709:in `block in from_string'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:708:in `chdir'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:708:in `from_string'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:689:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/external_sources/abstract_external_source.rb:164:in `store_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/external_sources/path_source.rb:17:in `block in fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/external_sources/path_source.rb:11:in `fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:901:in `fetch_external_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:880:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:879:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:879:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:878:in `fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52: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>'


――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.


I have also tried uninstalling my cocoapods and re-installing it. My cocoapods version is 1.8.4. I have tried with version 1.6 as well.

What could be wrong in my system, as the same code works fine in other computers.

The podspec file for my react native project is as follows:

require 'json'

# Returns the version number for a package.json file
pkg_version = lambda do |dir_from_root = '', version = 'version'|
  path = File.join(__dir__, dir_from_root, 'package.json')
  JSON.parse(File.read(path))[version]
end

# Let the main package.json decide the version number for the pod
rnnearbee_version = pkg_version.call
# Use the same RN version that the JS tools use
react_native_version = pkg_version.call('../react-native')

Pod::Spec.new do |s|
  s.name             = 'RNNearBee'
  s.version          = rnnearbee_version
  s.description      = 'A wrapper for NearBee.'
  s.summary          = 'Components for RNNearBee.'
  s.homepage         = 'github repo'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'author' }
  s.source           = { :git => 'githuib', :tag => s.version.to_s }

  s.source_files   = 'ios/*.{h,m}'
  s.platform       = :ios, '10.0'

  # React is split into a set of subspecs, these are the essentials
  s.dependency 'React/Core', react_native_version
  s.dependency 'React/CxxBridge', react_native_version
  s.dependency 'React/RCTAnimation', react_native_version
  s.dependency 'React/RCTImage', react_native_version
  s.dependency 'React/RCTLinkingIOS', react_native_version
  s.dependency 'React/RCTNetwork', react_native_version
  s.dependency 'React/RCTText', react_native_version

  # React's dependencies
  s.dependency 'yoga', "#{react_native_version}.React"
  podspecs = [
    '../react-native/third-party-podspecs/DoubleConversion.podspec',
    '../react-native/third-party-podspecs/Folly.podspec',
    '../react-native/third-party-podspecs/glog.podspec'
  ]
  podspecs.each do |podspec_path|
    spec = Pod::Specification.from_file podspec_path
    s.dependency spec.name, "#{spec.version}"
  end

  s.dependency 'NearBee', '~> 0.2.2'
end ```
1

There are 1 best solutions below

0
On
  • Download curl from https://curl.haxx.se/windows/
  • Extract the archive and browse into /bin
  • Rename libcurl_x64.dll (it may be just libcurl.dll for x86) to libcurl.dll
  • Copy and paste the file into the /bin directory of your Ruby installation folder

Happy coding!