ruby-on-rails – 抛出normalize_yaml_input中的无效字节序列错误?

尝试将项目推送到Heroku时,我收到错误(下面).谷歌发现有几个人出现了类似的问题,但是在错误之前,有一个不同的宝石作为最后的宝石,所以我不认为这与监狱长有关.我发现一些类似的错误/ github问题有解决方案指向一个 rubygems错误,这显然是 to be fixed in 1.8.10(我已经有,所以我怀疑这是这个问题.

任何建议将不胜感激 – 我确定这是我错过的简单.

cobychapple at shiva in ~/code/zzz on master!
± git push heroku master
Counting objects: 201,done.
Delta compression using up to 2 threads.
Compressing objects: 100% (181/181),done.
Writing objects: 100% (201/201),92.14 KiB,done.
Total 201 (delta 38),reused 0 (delta 0)

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected,running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       Fetching source index for http://rubygems.org/
       Installing rake (0.9.2.2) 
       Installing multi_json (1.0.3) 
       Installing activesupport (3.1.2) 
       Installing builder (3.0.0) 
       Installing i18n (0.6.0) 
       Installing activemodel (3.1.2) 
       Installing erubis (2.7.0) 
       Installing rack (1.3.5) 
       Installing rack-cache (1.1) 
       Installing rack-mount (0.8.3) 
       Installing rack-test (0.6.1) 
       Installing hike (1.2.1) 
       Installing tilt (1.3.3) 
       Installing sprockets (2.1.2) 
       Installing actionpack (3.1.2) 
       Installing mime-types (1.17.2) 
       Installing polyglot (0.3.3) 
       Installing treetop (1.4.10) 
       Installing mail (2.3.0) 
       Installing actionmailer (3.1.2) 
       Installing arel (2.2.1) 
       Installing tzinfo (0.3.31) 
       Installing activerecord (3.1.2) 
       Installing activeresource (3.1.2) 
       Installing addressable (2.2.6) 
       Installing bcrypt-ruby (3.0.1) with native extensions 
       Installing coffee-script-source (1.1.3) 
       Installing execjs (1.2.9) 
       Installing coffee-script (2.2.0) 
       Installing rack-ssl (1.3.2) 
       Installing json (1.6.1) with native extensions 
       Installing rdoc (3.11) 
       Installing thor (0.14.6) 
       Installing railties (3.1.2) 
       Installing coffee-rails (3.1.1) 
       Installing orm_adapter (0.0.5) 
       Installing warden (1.1.0) 
       /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/specification.rb:519:in `normalize_yaml_input': invalid byte sequence in US-ASCII (ArgumentError)
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/specification.rb:479:in `from_yaml'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:183:in `load_gemspec'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:51:in `block in initialize'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:32:in `initialize'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `new'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `open'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package.rb:58:in `open'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/format.rb:63:in `from_io'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/format.rb:51:in `block in from_file_by_path'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/format.rb:50:in `from_file_by_path'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/source.rb:72:in `fetch'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:45:in `block in run'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `block in each'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
        from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>'
        from /usr/ruby1.9.2/bin/bundle:19:in `load'
        from /usr/ruby1.9.2/bin/bundle:19:in `<main>'
       Failed: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected,Failed to install gems via Bundler

To git@heroku.com:zzz.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: Failed to push some refs to 'git@heroku.com:zzz.git'

这是捆绑安装的输出,以防它有助于:

cobychapple at shiva in ~/code/zzz on master
± bundle install
Using rake (0.9.2.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.2) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.2) 
Using erubis (2.7.0) 
Using rack (1.3.5) 
Using rack-cache (1.1) 
Using rack-mount (0.8.3) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.2) 
Using actionpack (3.1.2) 
Using mime-types (1.17.2) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.1.2) 
Using arel (2.2.1) 
Using tzinfo (0.3.31) 
Using activerecord (3.1.2) 
Using activeresource (3.1.2) 
Using addressable (2.2.6) 
Using ansi (1.4.1) 
Using bcrypt-ruby (3.0.1) 
Using bundler (1.0.18) 
Using coffee-script-source (1.1.3) 
Using execjs (1.2.9) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.1) 
Using rdoc (3.11) 
Using thor (0.14.6) 
Using railties (3.1.2) 
Using coffee-rails (3.1.1) 
Using orm_adapter (0.0.5) 
Using warden (1.1.0) 
Using devise (1.5.1) 
Using faker (1.0.1) 
Using rails (3.1.2) 
Using formtastic (2.0.2) 
Using formtastic-bootstrap (1.0.1) 
Using haml (3.1.3) 
Using launchy (2.0.5) 
Using rest-client (1.6.7) 
Using rubyzip (0.9.4) 
Using term-ansicolor (1.0.7) 
Using heroku (2.14.0) 
Using jquery-rails (1.0.18) 
Using kaminari (0.12.4) 
Using populator (1.0.0) 
Using sass (3.1.10) 
Using sass-rails (3.1.5) 
Using sequel (3.20.0) 
Using sinatra (1.0) 
Using sqlite3 (1.3.4) 
Using sqlite3-ruby (1.3.3) 
Using taps (0.3.23) 
Using turn (0.8.2) 
Using uglifier (1.1.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Rubygems版本:

cobychapple at shiva in ~/code/zzz on master
± gem -v
1.8.10

解决方法

我有同样的问题,并将其放在我的Gemfile顶部:
if RUBY_VERSION =~ /1.9/
  Encoding.default_external = Encoding::UTF_8
  Encoding.default_internal = Encoding::UTF_8
end

如本post所示.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...