特拉维斯(Windows):未定义的方法'尝试'

时间:2015-01-22 10:11:03

标签: ruby travis-ci

我完全不了解Ruby,我只是试图用它来加密我的.travis.yml的参数。每当我运行travis pubkey -r user/project时,我都会收到错误

undefined method `try' for #<Faraday::Env:0x289a748>
for a full error report, run travis report

完整的报告是(我更改了一些私人数据):

C:\Users\xyz\Documents\Dev\WorkspacePhpStorm\xyz>travis report
System
Ruby:                     Ruby 2.1.3-p242
Operating System:         Windows
RubyGems:                 RubyGems 2.2.2

CLI
Version:                  1.7.5
Plugins:                  none
Auto-Completion:          yes
Last Version Check:       2015-01-22 10:16:22 +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 pubkey`:
NoMethodError: undefined method `try' for #<Faraday::Env:0x289a748>
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/remote.rb:71:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/normalizer.rb:8:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/parallel.rb:27:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/wrapper.rb:87:in `generate_response'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/remote.rb:88:in `request'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/gh-0.13.3/lib/gh/remote.rb:106:in `head'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/travis-1.7.5/lib/travis/cli/repo_command.rb:111:in `detect_api_endpoint'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/travis-1.7.5/lib/travis/cli/repo_command.rb:23:in `setup'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/travis-1.7.5/lib/travis/cli/command.rb:197:in `execute'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/travis-1.7.5/lib/travis/cli.rb:64:in `run'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/lib/ruby/gems/2.1.0/gems/travis-1.7.5/bin/travis:18:in `<top (required)>'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/bin/travis:23:in `load'
    from C:/Users/xyz/Documents/Dev/Tools/Ruby21/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.

有人能告诉我我做错了吗?

谢谢, 亚历

2 个答案:

答案 0 :(得分:1)

很可能缺少gem faraday。尝试通过在gemfile中添加以下内容来安装它:

gem 'faraday'

其次是

bundle install

<强>替代地

gem install faraday

答案 1 :(得分:0)

我在github上发现了一个问题,它解释了发生了什么:https://github.com/travis-ci/travis.rb/issues/265

TL; DR:降级gh:

gem uninstall gh
gem install gh -v 0.13.2