简体   繁体   中英

Encrypting files for travis-ci on ruby-2.2.2 fails with “private method `load' called for Psych:Module”

I'm having trouble encrypting my database.yml for Travis CI. Based on their documentation, it appears you encrypt files with the travis encrypt-file command . I'm running on Ruby-2.2.2 and it's giving me some pretty cryptic error messages.

travis encrypt-file config/database.yml --add

And I get this error:

private method `load' called for Psych:Module
for a full error report, run travis report

Here's the backtrace when I run travis report :

$ travis report 

/Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli/api_command.rb:150:in `default_endpoint': undefined method `[]' for nil:NilClass (NoMethodError)
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli/api_command.rb:154:in `detected_endpoint'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli/api_command.rb:70:in `detected_endpoint?'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli/api_command.rb:158:in `endpoint_option'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli/command.rb:213:in `rescue in execute'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli/command.rb:191:in `execute'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/lib/travis/cli.rb:64:in `run'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/travis-1.7.7/bin/travis:18:in `<top (required)>'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/bin/travis:23:in `load'
        from /Users/William.Jeffries/.rbenv/versions/2.2.2/bin/travis:23:in `<main>'

The solution was to uninstall Psych version 2.0.13 and have only 2.0.5 on my machine. I had both 2.0.5 and 2.0.13 and it seems that they were conflicting with each other. I found the information on this forum post .

gem update --system

在Ubuntu 14.04 + RVM + Ruby 2.1.1p76上为我解决了该问题,如以下网址所述: https : //github.com/bbatsov/rubocop/issues/1510#issuecomment-102645627

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM