travis-ci / travis.rb

Travis CI Client (CLI and Ruby library)
MIT License
1.59k stars 408 forks source link

"no implicit conversion of nil into String" when logging in #190

Closed jalanb closed 4 years ago

jalanb commented 10 years ago

Just d/l and installed travis cli onto Ubuntu 12.0, with ruby 2.1

First command I tried it asked me to log in, but then:

$ GLI_DEBUG=true travis login --pro
We need your GitHub login to identify you.
This information will not be sent to Travis CI, only to api.github.com.
The password will not be displayed.

Try running with --github-token or --auto if you don't want to enter your password anyway.

Username: jalanb
Password for jalanb: ***************
no implicit conversion of nil into String
for a full error report, run travis report --pro

$ GLI_DEBUG=true travis report --pro
System
Ruby:                     Ruby 2.1.1-p76
Operating System:         Ubuntu 12.04
RubyGems:                 RubyGems 2.2.2

CLI
Version:                  1.6.11
Plugins:                  none
Auto-Completion:          yes
Last Version Check:       never

Session
API Endpoint:             https://api.travis-ci.com/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
pro:                      https://api.travis-ci.com/ (current)

Last Exception
An error occurred running `travis login --pro`:
    TypeError: no implicit conversion of nil into String
        from /usr/lib/ruby/2.1.0/json/common.rb:155:in `initialize'
        from /usr/lib/ruby/2.1.0/json/common.rb:155:in `new'
        from /usr/lib/ruby/2.1.0/json/common.rb:155:in `parse'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/tools/github.rb:230:in `gh_error'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/tools/github.rb:206:in `rescue in login'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/tools/github.rb:195:in `login'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/tools/github.rb:74:in `possible_tokens'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/tools/github.rb:41:in `each_token'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/tools/github.rb:36:in `with_token'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/cli/login.rb:31:in `login'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/cli/login.rb:39:in `run'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/cli/command.rb:181:in `execute'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/lib/travis/cli.rb:60:in `run'
        from /var/lib/gems/2.1.0/gems/travis-1.6.11/bin/travis:18:in `<top (required)>'
        from /usr/local/bin/travis:23:in `load'
        from /usr/local/bin/travis:23:in `<main>'

For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
For Travis CI in general, go to https://github.com/travis-ci/travis-ci/issues or email support@travis-ci.com.
BanzaiMan commented 10 years ago

This is weird. Login with GitHub failed, but the error's response body was nil.

https://github.com/travis-ci/travis.rb/blob/v1.6.11/lib/travis/tools/github.rb#L230

Does the error persist?

JoeKarlsson commented 6 years ago

Just ran into this issue, has anyone found a fix for this?

JoeKarlsson commented 6 years ago

For me, this was a firewall issue. Once I went to another network without a firewall, I was able to login to Travis with no issues.

KyeRussell commented 6 years ago

Is this still an issue for anyone else? I am experiencing it now - no firewall issues.

vijayenthran commented 6 years ago

Same issue here. Facing it now :( . @BanzaiMan , Can you please help

screen shot 2018-02-24 at 10 21 06 am

AlexSugak commented 6 years ago

Same issue here. Trying to login using github token.

wiep commented 6 years ago

I've the same issue. It doesn't matter if I use a github-token or username and password.

username/password

System
Ruby:                     Ruby 2.0.0-p648
Operating System:         Mac OS X 10.11.6
RubyGems:                 RubyGems 2.0.14.1

CLI
Version:                  1.8.8
Plugins:                  none
Auto-Completion:          no
Last Version Check:       2018-02-28 15:22:12 +0100

Session
API Endpoint:             https://api.travis-ci.com/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
pro:                      https://api.travis-ci.com/ (current)

Last Exception
An error occurred running `travis login --pro`:
    TypeError: no implicit conversion of nil into String
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `initialize'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `new'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:262:in `gh_error'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:211:in `rescue in basic_auth'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:208:in `basic_auth'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:215:in `login'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:80:in `possible_tokens'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `each_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:36:in `with_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/login.rb:31:in `login'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/login.rb:40:in `run'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/command.rb:198:in `execute'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli.rb:64:in `run'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/bin/travis:18:in `<top (required)>'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/bin/travis:23:in `load'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/bin/travis:23:in `<main>'

For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
For Travis CI in general, go to https://github.com/travis-ci/travis-ci/issues or email support@travis-ci.com.

github-token

System
Ruby:                     Ruby 2.0.0-p648
Operating System:         Mac OS X 10.11.6
RubyGems:                 RubyGems 2.0.14.1

CLI
Version:                  1.8.8
Plugins:                  none
Auto-Completion:          no
Last Version Check:       2018-02-28 15:26:00 +0100

Session
API Endpoint:             https://api.travis-ci.com/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
pro:                      https://api.travis-ci.com/ (current)

Last Exception
An error occurred running `travis login --pro`:
    TypeError: no implicit conversion of nil into String
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `initialize'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `new'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:262:in `gh_error'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:254:in `rescue in acceptable?'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:243:in `acceptable?'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `block in each_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `[]'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `possible_tokens'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `each_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:36:in `with_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/login.rb:31:in `login'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/login.rb:40:in `run'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/command.rb:198:in `execute'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli.rb:64:in `run'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/bin/travis:18:in `<top (required)>'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/bin/travis:23:in `load'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/bin/travis:23:in `<main>'

For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
For Travis CI in general, go to https://github.com/travis-ci/travis-ci/issues or email support@travis-ci.com.
hancush commented 6 years ago

I had the same issue, but I solved it by upgrading to Ruby (from 2.0 to 2.3).

Not sure if it matters, but I was also using travis installed via Homebrew. I uninstalled that version and reinstalled as recommended with gem install travis -v 1.8.8 --no-rdoc --no-ri.

Original error:

System
Ruby:                     Ruby 2.0.0-p648
Operating System:         Mac OS X 10.11.6
RubyGems:                 RubyGems 2.0.14.1

CLI
Version:                  1.8.8
Plugins:                  none
Auto-Completion:          yes
Last Version Check:       2018-03-01 16:03:19 -0600

Session
API Endpoint:             https://api.travis-ci.com/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
pro:                      https://api.travis-ci.com/ (current)

Last Exception
An error occurred running `travis login --pro`:
    TypeError: no implicit conversion of nil into String
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `initialize'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `new'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:262:in `gh_error'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:254:in `rescue in acceptable?'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:243:in `acceptable?'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `block in each_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `[]'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `possible_tokens'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `each_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/tools/github.rb:36:in `with_token'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/login.rb:31:in `login'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/login.rb:40:in `run'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli/command.rb:198:in `execute'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/lib/travis/cli.rb:64:in `run'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/gems/travis-1.8.8/bin/travis:18:in `<top (required)>'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/bin/travis:23:in `load'
        from /usr/local/Cellar/travis/1.8.8_2/libexec/bin/travis:23:in `<main>'

For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
For Travis CI in general, go to https://github.com/travis-ci/travis-ci/issues or email support@travis-ci.com.
albertosottile commented 6 years ago

Some issue here:

System
Ruby:                     Ruby 2.0.0-p648
Operating System:         Mac OS X 10.12.6
RubyGems:                 RubyGems 2.7.6

CLI
Version:                  1.8.8
Plugins:                  none
Auto-Completion:          no
Last Version Check:       2018-03-05 23:49:56 +0100

Session
API Endpoint:             https://api.travis-ci.org/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
org:                      https://api.travis-ci.org/ (current)

Last Exception
An error occurred running `travis login`:
    TypeError: no implicit conversion of nil into String
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `initialize'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `new'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:262:in `gh_error'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:211:in `rescue in basic_auth'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:208:in `basic_auth'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:215:in `login'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:80:in `possible_tokens'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `each_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:36:in `with_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/login.rb:31:in `login'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/login.rb:40:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/command.rb:198:in `execute'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli.rb:64:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/bin/travis:18:in `<top (required)>'
        from /usr/local/bin/travis:23:in `load'
        from /usr/local/bin/travis:23:in `<main>'

For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
mazipan commented 6 years ago

Got same error, is there any solution for this issue ?

blackcappedchickadee commented 6 years ago

I had the same exact issues as what have been reported since Feb 23 2018, including the same exact stacktrace.

Thanks to what @hancush called out:

gem install travis -v 1.8.8 --no-rdoc --no-ri

...did the trick for me. I'm now able to sign in!

WuglyakBolgoink commented 6 years ago

@blackcappedchickadee doesn't work on me :(

System
Ruby:                     Ruby 2.0.0-p648
Operating System:         Mac OS X 10.12.6
RubyGems:                 RubyGems 2.0.14.1

CLI
Version:                  1.8.8
Plugins:                  none
Auto-Completion:          yes
Last Version Check:       2018-03-09 18:06:45 +0100

Session
API Endpoint:             https://api.travis-ci.org/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
org:                      https://api.travis-ci.org/ (current)

Last Exception
An error occurred running `travis login`:
    TypeError: no implicit conversion of nil into String
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `initialize'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `new'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:262:in `gh_error'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:254:in `rescue in acceptable?'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:243:in `acceptable?'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `block in each_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `[]'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `possible_tokens'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `each_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:36:in `with_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/login.rb:31:in `login'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/login.rb:40:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/command.rb:198:in `execute'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli.rb:64:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/bin/travis:18:in `<top (required)>'
        from /usr/local/bin/travis:23:in `load'
        from /usr/local/bin/travis:23:in `<main>'
albertosottile commented 6 years ago

I tried pretty much everything, with no luck. In the end I gave up and installed it using homebrew (brew install travis).

astromechza commented 6 years ago

I managed to workaround this by switching ruby versions. I was using ruby 2.0.0 and switched to ruby 2.3.3 with rbenv.

$ travis login --github-token ############
no implicit conversion of nil into String
for a full error report, run travis report
$ which travis
/usr/local/bin/travis
$ rbenv versions
* system (set by /Users/benmeier/.rbenv/version)
  2.3.0
  2.3.3
$ rbenv shell 2.3.3
$ gem install travis --no-rdoc --no-ri
Fetching: multipart-post-2.0.0.gem (100%)
Successfully installed multipart-post-2.0.0
Fetching: faraday-0.14.0.gem (100%)
Successfully installed faraday-0.14.0
Fetching: faraday_middleware-0.12.2.gem (100%)
Successfully installed faraday_middleware-0.12.2
Fetching: highline-1.7.10.gem (100%)
Successfully installed highline-1.7.10
Fetching: backports-3.11.1.gem (100%)
Successfully installed backports-3.11.1
Fetching: addressable-2.4.0.gem (100%)
Successfully installed addressable-2.4.0
Fetching: net-http-persistent-2.9.4.gem (100%)
Successfully installed net-http-persistent-2.9.4
Fetching: net-http-pipeline-1.0.1.gem (100%)
Successfully installed net-http-pipeline-1.0.1
Fetching: gh-0.15.1.gem (100%)
Successfully installed gh-0.15.1
Fetching: launchy-2.4.3.gem (100%)
Successfully installed launchy-2.4.3
Fetching: ethon-0.11.0.gem (100%)
Successfully installed ethon-0.11.0
Fetching: typhoeus-0.8.0.gem (100%)
Successfully installed typhoeus-0.8.0
Fetching: websocket-1.2.5.gem (100%)
Successfully installed websocket-1.2.5
Fetching: pusher-client-0.6.2.gem (100%)
Successfully installed pusher-client-0.6.2
Fetching: travis-1.8.8.gem (100%)
Successfully installed travis-1.8.8
15 gems installed
$ rbenv rehash
$ which travis
/Users/benmeier/.rbenv/shims/travis
$ travis login --github-token #################
Successfully logged in as AstromechZA!

Serves me right for running such an old ruby.

WuglyakBolgoink commented 6 years ago

@AstromechZA

I have just installed ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16] on my MacBook via brew

same error as before.

But... travis try to use old ruby again...

An error occurred running `travis login`:
    TypeError: no implicit conversion of nil into String
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `initialize'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `new'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:262:in `gh_error'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:254:in `rescue in acceptable?'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:243:in `acceptable?'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `block in each_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `[]'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:60:in `possible_tokens'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:49:in `each_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/tools/github.rb:36:in `with_token'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/login.rb:31:in `login'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/login.rb:40:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli/command.rb:198:in `execute'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/lib/travis/cli.rb:64:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/travis-1.8.8/bin/travis:18:in `<top (required)>'
        from /usr/local/bin/travis:23:in `load'
        from /usr/local/bin/travis:23:in `<main>'

$ ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]
astromechza commented 6 years ago

@WuglyakBolgoink Travis is still linked to the old 2.0.0 gems I assume. You'll need to reinstall the travis gem so that it links to your current ruby version.

WuglyakBolgoink commented 6 years ago

@AstromechZA thank you! fully re'install travis was very helpful! now I see no errors during login.

ice1000 commented 6 years ago

Same here, and the cause is I'm using https_proxy env var. Removing it resolves this.

stopsopa commented 6 years ago

same here: image

ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
travis -v
1.8.8
fongelias commented 6 years ago

I just spent forever and figured it out. There are a few gotchas that can prevent the whole thing from working. If you've installed it incorrectly once, you might run into this issue over and over again.

what I did (thanks to all the comments above) was: Make sure that your computer does not have any trace of travis on it

  1. make sure you have either an updated version of ruby (2.3.3 and above) either as your system default or on rbenv
  2. make sure that travis is not installed on any version of ruby (run gem uninstall travis on each of the rbenv versions you've tried to install it on, you can use gem list to see if it is installed)
  3. make sure that the binaries are all gone- both from your rbenv shims and your /usr/local/bin

Properly install travis to the correct version of ruby I haven't tried this on the system version since I'm using rbenv, but:

  1. make sure that your local ruby is 2.3.3 and above by using ruby -v
  2. run gem install travis -v 1.8.8 --no-rdoc --no-ri to install travis to your local ruby version
  3. run rbenv rehash to make sure that the shims are installed
  4. run travis and look at the last line. It should have a path showing the ruby version you are using.

This worked for me, and I think that if everyone makes sure that their computer is not in a strange state, it should work for everyone else. Hope this helps!

ArcherN9 commented 6 years ago

Thanks @fongelias That worked for me! I did not have to follow the full guide though, just upgrading ruby via rvm and reinstalling travis did it.

For people who want to update ruby using rvm or brew, refer this link.

I guess this ticket could be closed. No?

jtontiwith commented 6 years ago

I installed the latest version of ruby with Homebrew brew install ruby and ran sudo gem install travis -v 1.8.8 --no-rdoc --no-ri and that worked for me. I didn't touch my system ruby install at /usr/bin/ruby.

pckilgore commented 5 years ago

Still seeing the error after following @fongelias 's instructions...

BanzaiMan commented 4 years ago

This should be fixed by https://github.com/travis-ci/travis.rb/commit/59ef9811166a54c8ac30b3e6c86b12f648b6753b.