gpt4 book ai didi

ruby-on-rails - rake Assets :precompile not working on heroku

转载 作者:行者123 更新时间:2023-12-03 14:36:56 28 4
gpt4 key购买 nike

我的网站曾经可以运行,Heroku 预编译了 Assets 和所有内容。现在,似乎无处不在,我开始收到 rake aborted! stack level too deep在部署。

删除线路 *= require_tree .从我的 application.css 文件似乎修复了 stack level too deep但后来我明白了:

Running: rake assets:precompile
(in /tmp/build_b8o2t4k8frce)
/usr/local/bin/ruby /tmp/build_b8o2t4k8frce/vendor/bundle/ruby/1.9.1/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
(in /tmp/build_b8o2t4k8frce)

我所有的图片链接都被破坏了(我在我的 css 文件中使用了 image-url())。可能是什么问题,我该如何解决?

我正在使用雪松堆栈,这是我的 gemfile:
gem 'rails', '3.1.0'
gem 'rake', '0.8.7'
gem 'devise'

group :production do
gem 'pg'
gem 'thin'
end

group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end

这是heroku使用的版本:
Using rake (0.8.7)
Using rails (3.1.0)
Using sass (3.1.15)
Using sass-rails (3.1.6)

这是我的 application.rb 文件
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end

module App
class Application < Rails::Application

# Enable the asset pipeline
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
end
end

这是我的 production.rb 文件
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

# Enable Rails's static asset server (Apache or nginx will not need this)
config.serve_static_assets = true

# Set expire header of 30 days for static files
config.static_cache_control = "public, max-age=2592000"

# Allow JavaScript and CSS compression
config.assets.compress = true

# Compress JavaScript by removing whitespace, shortening variable names, ...
config.assets.js_compressor = :uglifier

# 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

最佳答案

我遇到了类似的问题,并在这里找到了答案:https://github.com/rails/sass-rails/issues/78 .基本上,降级到 sass-rails v3.1.4。希望这可以帮助

关于ruby-on-rails - rake Assets :precompile not working on heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9787766/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com