在将项目部署到heroku时编译资产时出错

时间:2015-11-08 17:46:35

标签: ruby-on-rails git ruby-on-rails-4 heroku deployment

我是ROR的新手。我已经完成了我的应用程序的创建,并尝试使用git push heroku master将其部署到heroku上。以下是执行推送时出现的错误。

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using bundler 1.9.7
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
       Fetching gem metadata from https://rubygems.org/............
       Fetching version metadata from https://rubygems.org/...
       Fetching dependency metadata from https://rubygems.org/..
       Resolving dependencies...
       Rubygems 2.0.14 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
       Installing rake 10.4.2
       Installing i18n 0.7.0
       Installing json 1.8.3
       Installing minitest 5.8.2
       Installing thread_safe 0.3.5
       Installing tzinfo 1.2.2
       Installing activesupport 4.2.4
       Installing builder 3.2.2
       Installing erubis 2.7.0
       Installing mini_portile 0.6.2
       Installing nokogiri 1.6.6.2
       Installing rails-deprecated_sanitizer 1.0.3
       Installing rails-dom-testing 1.0.7
       Installing loofah 2.0.3
       Installing rails-html-sanitizer 1.0.2
       Installing actionview 4.2.4
       Installing rack 1.6.4
       Installing rack-test 0.6.3
       Installing actionpack 4.2.4
       Installing globalid 0.3.6
       Installing activejob 4.2.4
       Installing mime-types 2.6.2
       Installing mail 2.6.3
       Installing actionmailer 4.2.4
       Installing activemodel 4.2.4
       Installing arel 6.0.3
       Installing activerecord 4.2.4
       Installing execjs 2.6.0
       Installing autoprefixer-rails 6.1.0.1
       Installing sass 3.4.19
       Installing bootstrap-sass 3.3.5.1
       Using bundler 1.9.7
       Installing coffee-script-source 1.9.1.1
       Installing coffee-script 2.4.1
       Installing thor 0.19.1
       Installing railties 4.2.4
       Installing coffee-rails 4.1.0
       Installing hoe 3.14.2
       Installing email_form_generator 1.0.5
       Installing multi_json 1.11.2
       Installing jbuilder 2.3.2
       Installing jquery-rails 4.0.5
       Installing mail_form 1.5.1
       Installing mysql2 0.3.20
       Installing sprockets 3.4.0
       Installing sprockets-rails 2.3.3
       Installing rails 4.2.4
       Installing rdoc 4.2.0
       Installing tilt 2.0.1
       Installing sass-rails 5.0.4
       Installing sdoc 0.4.1
       Installing simple_form 3.2.0
       Installing turbolinks 2.5.3
       Installing twitter-bootstrap-rails 3.2.0
       Installing uglifier 2.7.2
       Bundle complete! 17 Gemfile dependencies, 55 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Post-install message from rdoc:
       Depending on your version of ruby, you may need to install ruby rdoc/ri data:
       <= 1.8.6 : unsupported
       = 1.8.7 : gem install rdoc-data; rdoc-data --install
       = 1.9.1 : gem install rdoc-data; rdoc-data --install
       >= 1.9.2 : nothing to do! Yay!
       Post-install message from twitter-bootstrap-rails:
       Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.
       **********************************************
       ExecJS supports these runtimes:
       therubyracer - Google V8 embedded within Ruby
       therubyrhino - Mozilla Rhino embedded within JRuby
       Node.js
       Apple JavaScriptCore - Included with Mac OS X
       Microsoft Windows Script Host (JScript)
       **********************************************
       Bundle completed (38.64s)
       Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       I, [2015-11-08T17:03:09.207713 #1298]  INFO -- : Writing /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/public/assets/style-0d5b3b0455ab9ba65ebe32a86e21555d4450dec914b7a0afa745eb5f5894a6dd.css
       I, [2015-11-08T17:03:10.617234 #1298]  INFO -- : Writing /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/public/assets/jquery.min-02ff0ccffcd57eb8f53a39655db509a0cf9e9f98e20acd1434caf5645e2e228b.js
       I, [2015-11-08T17:03:10.984452 #1298]  INFO -- : Writing /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/public/assets/cufon-yui-9c4d31adc3a9244d12c849264ba11fb36133a6994eabbd38c3ebe5e6674ada2e.js
       rake aborted!
       JSON::GeneratorError: source sequence is illegal/malformed utf-8
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:46:in `call'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/uglifier-2.7.2/lib/uglifier.rb:212:in `run_uglifyjs'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/uglifier-2.7.2/lib/uglifier.rb:179:in `compile'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/uglifier_compressor.rb:52:in `call'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:60:in `block in load'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/loader.rb:44:in `load'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/cached_environment.rb:47:in `yield'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/cached_environment.rb:47:in `load'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/base.rb:66:in `find_asset'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:130:in `block in find'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:129:in `each'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:129:in `find'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:162:in `compile'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-3.4.0/lib/rake/sprocketstask.rb:147:in `with_logger'
       /tmp/build_bbd2a8ff0f85aebead85caa8937e84cd/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
       Tasks: TOP => assets:precompile
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app

我尝试在本地预编译但在本地执行此操作时出错是不同的。见下图。

error while performing rake assets:compile

我该怎么办?我一直在寻找解决方案已经有一段时间了,我找不到具体问题。

我的application.css文件包含* = require bootstrappl,所以我删除了以检查它是否可以正常工作。现在我能够在本地预编译资产,但仍然无法部署heroku遇到相同的错误。

JSON :: GenerateError:源序列非法/格式错误utf-8

请帮忙。

如果您需要我的任何代码,请告诉我。

1 个答案:

答案 0 :(得分:0)

尝试在Rakefile中设置字符编码以纠正一个put:

#encoding: cp1250

在你的Rakefile之上。 (将cp1250替换为您的编码)。 并阅读有关该主题的内容。