问题
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>'
回答1:
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.
回答2:
gem update --system
solved it for me on Ubuntu 14.04 + RVM + Ruby 2.1.1p76 as mentioned at: https://github.com/bbatsov/rubocop/issues/1510#issuecomment-102645627
来源:https://stackoverflow.com/questions/31105448/encrypting-files-for-travis-ci-on-ruby-2-2-2-fails-with-private-method-load-c