xcpretty / xcode-install

🔽 Install and update your Xcodes
https://fastlane.tools
MIT License
2.58k stars 237 forks source link

`xcversion update`: NoMethodError: undefined method `first' for nil:NilClass #348

Open commscheck opened 4 years ago

commscheck commented 4 years ago

Possibly due to Xcode 11 coming out of beta?

❯ bundle exec xcversion update
Available session is not valid any more. Continuing with normal login.
bundler: failed to load command: xcversion (/Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/bin/xcversion)
NoMethodError: undefined method `first' for nil:NilClass
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/lib/xcode/install.rb:447:in `prereleases'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/lib/xcode/install.rb:382:in `fetch_seedlist'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/lib/xcode/install.rb:201:in `seedlist'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/lib/xcode/install.rb:416:in `list_versions'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/lib/xcode/install.rb:307:in `list'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/lib/xcode/install/update.rb:10:in `run'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.1/bin/xcversion:12:in `<top (required)>'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/bin/xcversion:23:in `load'
  /Users/ben/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/bin/xcversion:23:in `<top (required)>'
❯ bundle exec xcversion --version
2.6.1
❯ rbenv version
2.6.3 (set by /Users/ben/src/MyProject/.ruby-version)
eugene-krinitsyn commented 4 years ago

@commscheck While waiting for the fix, you can hotfix it locally: Navigate to ⁨Users⁩/<USERNAME>/rbenv⁩/versions⁩/<VERSION>/lib⁩/ruby⁩/gems⁩/<VERSION>/gems⁩/xcode-install-<VERSION>/lib⁩/xcode⁩/install.rb and comment line 382 that calls prereleases function.

jjochen commented 4 years ago

Apparently this line in Apples seedlist response is interpreted as a release:

<p>Installation requires macOS 10.15 beta or Xcode 11 GM seed.</p>

Happens here.

tedgonzalez commented 4 years ago

Thanks @eugene-krinitsyn!

This works for (chruby/ rvm/ rbenv / any ruby version manager)

When you call

xcversion update
  1. Get the path of the failing file -> install.rb
  2. Open it in your editor

enter image description here

  1. Comment line 382

enter image description here

source https://stackoverflow.com/a/58046738/3040446

acevif commented 4 years ago

@eugene-krinitsyn Thanks! It worked for me.

pcoltau commented 4 years ago

@eugene-krinitsyn Thanks! Just a note, I'm using rvm and found mine in /Users/<USERNAME>/.rvm/gems/ruby-<RUBY-VERSION>/gems/xcode-install-<XCODE-INSTALL-VERSION>/lib/xcode/install.rb

udayasri commented 4 years ago

@eugene-krinitsyn Thanks, it worked

daneov commented 4 years ago

Is there a sample of the entry (or web response) that gets parsed wrongly? I'd love to help fix this.

dDomovoj commented 4 years ago

@eugene-krinitsyn You're the best!