Cocoapods: NoMethodError - undefined method `url' for nil:NilClass

Created on 23 Mar 2020  路  6Comments  路  Source: CocoaPods/CocoaPods

Command

/usr/local/bin/pod trunk push Singularkey.podspec

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.9.1
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15 (19A573a)
       Xcode : 11.2.1 (11B500)
         Git : git version 2.21.0 (Apple Git-122.2)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : cocoapods- - CDN - https://cdn.cocoapods.org/
               master - git - https://github.com/CocoaPods/Specs.git @ e89f5cb3e4d36f9a80c0973932701e0391c4a909

               Singularkey - git - https://github.com/singularkey/singularkey-specs @ 6aebae7b9b1c41f1c8e981b57302627f4b61350d

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

Error

NoMethodError - undefined method `url' for nil:NilClass
/Library/Ruby/Gems/2.6.0/gems/cocoapods-trunk-1.4.1/lib/pod/command/trunk/push.rb:156:in `master_repo_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-trunk-1.4.1/lib/pod/command/trunk/push.rb:121:in `validate_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-trunk-1.4.1/lib/pod/command/trunk/push.rb:70:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
help wanted awaiting input

Most helpful comment

I also encountered this problem, my solution is:

  1. rm -rf ~/.cocoapods/repos (may not be necessary)
  2. Remove the explicit source declaration at the top of the podfile file:
    # source 'https://cdn.cocoapods.org/'
  3. Run pod install again

At this time, Podfile.lock will display trunk, And before that it shows source https://cdn.cocoapods.org/

All 6 comments

Please specify pod repo list and also run at least once pod install in a project as we think the trunk repo must be set.

@dnkoutso
pod repo list output:

cocoapods-
- Type: CDN
- URL:  https://cdn.cocoapods.org/
- Path: /Users/regeint/.cocoapods/repos/cocoapods-

master
- Type: git (master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/regeint/.cocoapods/repos/master

Singularkey
- Type: git (master)
- URL:  https://github.com/singularkey/singularkey-specs
- Path: /Users/regeint/.cocoapods/repos/Singularkey

3 repos

pod install output:

Analyzing dependencies
[!] Unable to find a specification for `Singularkey`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

I am not sure what is wrong here. You would have to debug https://github.com/CocoaPods/cocoapods-trunk/blob/master/lib/pod/command/trunk/push.rb#L156 and see whats wrong.

@dnkoutso I have been using cocoapods since 2016 in my machine and it is running Mac OS catalina beta. I uninstalled all cocoapods gem from my machine. Installed fresh cocopods and it worked.

I also encountered this problem, my solution is:

  1. rm -rf ~/.cocoapods/repos (may not be necessary)
  2. Remove the explicit source declaration at the top of the podfile file:
    # source 'https://cdn.cocoapods.org/'
  3. Run pod install again

At this time, Podfile.lock will display trunk, And before that it shows source https://cdn.cocoapods.org/

@rakuyoMo it worked after rm -rf ~/.cocoapods/repos (may not be necessary) :D

Was this page helpful?
0 / 5 - 0 ratings