ruby-on-rails - Heroku - 预编译 Assets 失败。推送被拒绝,无法编译 Ruby 应用程序

标签 ruby-on-rails ruby git heroku push

我对 RoR 有点太陌生,无法发现错误所在。一直关注 railstutorial.org,我在推送到 heroku 时得到了这个。

它是否因此而中止 --> NoMethodError:未定义的方法 `link_to' for .

?? 这是我自己能够发现的唯一一件事。

 warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Fetching repository, done.
Counting objects: 88, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (56/56), done.
Writing objects: 100% (62/62), 23.47 KiB | 0 bytes/s, done.
Total 62 (delta 25), reused 0 (delta 0)

-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.5.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from https://rubygems.org/..........
       Fetching additional metadata from https://rubygems.org/..
       Using rake (10.2.2)
       Using i18n (0.6.9)
       Using minitest (4.7.5)
       Using multi_json (1.9.2)
       Using atomic (1.1.16)
       Using tzinfo (0.3.39)
       Using builder (3.1.4)
       Using erubis (2.7.0)
       Using rack (1.5.2)
       Using mime-types (1.25.1)
       Using activerecord-deprecated_finders (1.0.3)
       Using polyglot (0.3.4)
       Using arel (4.0.2)
       Using sass (3.3.4)
       Using coffee-script-source (1.7.0)
       Using execjs (2.0.2)
       Using thor (0.19.1)
       Using hike (1.2.3)
       Using json (1.8.1)
       Using pg (0.15.1)
       Using bundler (1.5.2)
       Using tilt (1.4.1)
       Using rails_serve_static_assets (0.0.2)
       Using rails_stdout_logging (0.0.3)
       Using thread_safe (0.3.1)
       Using treetop (1.4.15)
       Using uglifier (2.1.1)
       Using rdoc (3.12.2)
       Using rails_12factor (0.0.2)
       Using activesupport (4.0.4)
       Using mail (2.5.4)
       Using sdoc (0.3.20)
       Using activemodel (4.0.4)
       Using jbuilder (1.0.2)
       Using rack-test (0.6.2)
       Using activerecord (4.0.4)
       Using actionpack (4.0.4)
       Using actionmailer (4.0.4)
       Using railties (4.0.4)
       Using jquery-rails (3.0.4)
       Using coffee-script (2.2.0)
       Using coffee-rails (4.0.1)
       Using turbolinks (1.1.1)
       Installing sprockets (2.11.0)
       Using sprockets-rails (2.0.1)
       Using rails (4.0.4)
       Using sass-rails (4.0.1)
       Installing bootstrap-sass (2.3.2.0)
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (8.36s)
       Cleaning up the bundler cache.
       Removing sprockets (2.12.0)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       I, [2014-05-08T09:29:54.385001 #707]  INFO -- : Writing /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/public/assets/rails-9526610ae44d9e73134fd4337d78a4bb.png
       I, [2014-05-08T09:29:59.414656 #707]  INFO -- : Writing /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/public/assets/application-354cc53e50f2562d96d57a34facbc739.js
       rake aborted!
       NoMethodError: undefined method `link_to' for #<#<Class:0x007f34511a3ad8>:0x007f34503d11f8>
       (in /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb)
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:8:in `block in singleton class'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:-5:in `instance_eval'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:-5:in `singleton class'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:-7:in `__tilt_69931320843940'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/processed_asset.rb:12:in `initialize'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `new'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `block in build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:395:in `circular_call_protection'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:373:in `build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
       /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59: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

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

最佳答案

这是您仔细阅读的错误:

NoMethodError: undefined method `link_to' for #<#<Class:0x007f34511a3ad8>:0x007f34503d11f8>
       (in /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb)

正如@Merek 所指出的,您的assets/stylesheets 文件夹中有一个_footer.html.erb 文件。由于 rake assets:precompile 基本上采用您的 CSS 并将其转换为预编译代码,这表示它无法处理 link_to

删除文件,重新提交并重新推送到 Heroku。它应该可以工作,除非你有其他的 rouge 文件

关于ruby-on-rails - Heroku - 预编译 Assets 失败。推送被拒绝,无法编译 Ruby 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23538019/

相关文章:

c# - 微软git上 "Edited in both"冲突如何解决?

Git:处理应用程序缓存?

ruby-on-rails - Nginx 正好在 60 秒后超时

ruby-on-rails - 获取实例变量的名称

ruby - 基于 OOP 的文本游戏中的优雅命令解析

ruby - 通过 IntelliJ 在 sdk 中找不到 Rspec gem

git - 在 Git 中创建一个新的干净分支以进行 v2 重写

ruby-on-rails - 如何根据枚举验证 Rails 模型?

ruby-on-rails - Ruby on Rails 中的 Fields_for 方法

ruby-on-rails - Rails 3 - 未定义的方法 `delivery_handler='