Ruby on rails Heroku预编译资产失败

Ruby on rails Heroku预编译资产失败,ruby-on-rails,ruby-on-rails-3,deployment,heroku,asset-pipeline,Ruby On Rails,Ruby On Rails 3,Deployment,Heroku,Asset Pipeline,更新后,我的应用程序突然无法工作。不确定出了什么问题。基本上,当我推到heroku时,会出现以下错误: Precompiling assets failed, enabling runtime asset compilation Injecting rails31_enable_runtime_asset_compilation 再往上一点: rake aborted! Unexpected token: operator (>) (line: 19073, col: 9,

更新后,我的应用程序突然无法工作。不确定出了什么问题。基本上,当我推到heroku时,会出现以下错误:

Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
再往上一点:

   rake aborted!
   Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
   Error
   at new JS_Parse_Error (/tmp/execjs20121211-811-1z5vum.js:1720:22)
   at js_error (/tmp/execjs20121211-811-1z5vum.js:1728:15)
   at croak (/tmp/execjs20121211-811-1z5vum.js:2189:17)
   at token_error (/tmp/execjs20121211-811-1z5vum.js:2196:17)
   at unexpected (/tmp/execjs20121211-811-1z5vum.js:2202:17)
   at /tmp/execjs20121211-811-1z5vum.js:2580:17
   at maybe_unary (/tmp/execjs20121211-811-1z5vum.js:2665:27)
   at expr_op (/tmp/execjs20121211-811-1z5vum.js:2685:45)
   at expr_ops (/tmp/execjs20121211-811-1z5vum.js:2692:24)
   at maybe_conditional (/tmp/execjs20121211-811-1z5vum.js:2696:28)
当我实际加载该站点(“很抱歉,出现了一些问题”)并查看heroku日志时,我发现:

Load path: /app
2012-12-11T23:18:13+00:00 app[web.1]:     8:     <%= stylesheet_link_tag "application", :media => "all" %>
2012-12-11T23:18:13+00:00 app[web.1]:   (in /app/app/assets/stylesheets/custom.css.scss)):
2012-12-11T23:18:13+00:00 app[web.1]:     6:     <link href='http://fonts.googleapis.com/css?family=Kreon' rel='stylesheet' type='text/css'>
2012-12-11T23:18:13+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2012-12-11T23:18:13+00:00 app[web.1]:     5:     <title><%= full_title(yield(:title)) %></title>
2012-12-11T23:18:13+00:00 app[web.1]:     7:     <%= favicon_link_tag 'favicon.ico' %>
2012-12-11T23:18:13+00:00 app[web.1]:     10:     <%= csrf_meta_tags %>
2012-12-11T23:18:13+00:00 app[web.1]:   app/assets/stylesheets/custom.css.scss:1
2012-12-11T23:18:13+00:00 app[web.1]:     11:     <meta name="google-site-verification" content="idIPkgRBikSL9PCS4rVkkZfRjxYbPxNbyF6tVymBWbc" />
2012-12-11T23:18:13+00:00 app[web.1]: 
2012-12-11T23:18:13+00:00 app[web.1]: 
production.rb

MyApp::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # Code is not reloaded between requests
  config.cache_classes = true

  # Force all access to the app over SSL, use Strict-Transport-Security, 
  # and use secure cookies.
  config.force_ssl = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = true

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to nil and saved in location specified by config.assets.prefix
  # config.assets.manifest = YOUR_PATH

  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # See everything in the log (default is :info)
  # config.log_level = :debug

  # Prepend all log lines with the following tags
  # config.log_tags = [ :subdomain, :uuid ]

  # Use a different logger for distributed setups
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

  # Use a different cache store in production
  # config.cache_store = :mem_cache_store

  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "http://assets.example.com"

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  # config.assets.precompile += %w( search.js )

  # Disable delivery errors, bad email addresses will be ignored
  # config.action_mailer.raise_delivery_errors = false

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
end
真正吸引我的是我heroku推送日志中的这一行:

Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
问题是,我不知道该在哪个文件中查找这个麻烦的“>”。你知道如何阅读该行/col/pos命名法来找到真正令人不快的代码片段吗


谢谢。

app/assets/stylesheets/custom.css.scss
的第1行开始,寻找错误的
。 还要确保application.scss是您所期望的


另外,只需将
custom.css.scss
重命名为just
custom.scss
Heck,就可以了。

app/assets/stylesheets/custom.css.scss
的第1行开始,然后查找错误
。 还要确保application.scss是您所期望的


另外,只需将
custom.css.scss
重命名为just
custom.scss
Heck,就可以了。

同样的事情也发生在我身上,
“预编译资产失败。”推送到heroku时,
在我的开发环境中,我的css中有一个错误:
“………
光标:指针
颜色:#808080;“

“指针”后缺少“;”, 开发环境并不介意这个错误, 但是Heroku的预编译任务做到了


其他一些问题可能是由重复的命名文件(带有“css”和“css.scss”后缀)引起的。

同样的事情也发生在我身上,
“预编译资产失败。”推送到heroku时,
在我的开发环境中,我的css中有一个错误:
“………
光标:指针
颜色:#808080;“

“指针”后缺少“;”, 开发环境并不介意这个错误, 但是Heroku的预编译任务做到了


其他一些问题可能是由重复的命名文件(带有“css”和“css.scss”后缀)引起的。

在终端中尝试以下操作:

rake assets:precompile RAILS_ENV=production --trace
总比试图逼迫希罗库好

我只是犯了同样的错误。 问题是:

  • 已对designe的config.secret\u密钥进行了注释
  • javascript文件中的语法错误(for循环中的“of”而不是“in”)

在终端中尝试以下操作:

rake assets:precompile RAILS_ENV=production --trace
总比试图逼迫希罗库好

我只是犯了同样的错误。 问题是:

  • 已对designe的config.secret\u密钥进行了注释
  • javascript文件中的语法错误(for循环中的“of”而不是“in”)

事实上,问题似乎是当我将一些.js文件更改为js.coffee文件时,git也保留了.js版本,而具有不同扩展名的相同文件导致了问题。重命名并尝试推送自定义。无论我指出什么,当我删除冗余文件时,一切都正常。谢谢你给我指出了正确的方向!没问题。等到你在资产预编译方面也遇到了更大的问题时,你会发现有趣的事情真的开始了!是的,这里也有同样的问题,并且有一个爆炸@pjammerSo事实上,问题似乎是当我将一些.js文件更改为js.coffee文件时,git也保留了.js版本,并且具有不同扩展名的相同文件导致了一个问题。重命名并尝试推送自定义。无论我指出什么,当我删除冗余文件时,一切都正常。谢谢你给我指出了正确的方向!没问题。等到你在资产预编译方面也遇到了更大的问题时,你会发现有趣的事情真的开始了!是的,这里也有同样的问题,而且在pjammer有一个爆炸