My website used to be working and Heroku precompiled the assets and everything. Now, seemingly out of nowhere, I started to get rake aborted! stack level too deep
on deploy.
我的网站曾经是工作的,而Heroku预先编译了资产和一切。现在,不知从哪里冒出来的,我开始把耙子打掉!堆栈级在部署时太深。
Deleting the line *= require_tree .
from my application.css file seems to fix thestack level too deep
but then I get this:
删除行*= require_tree。从我的应用程序。css文件似乎把堆栈层次修改得太深了,但是我得到了:
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)
All my links to images are broken (I'm using image-url() in my css file). What could be the problem and how do I fix it?
我所有的图像链接都被破坏了(我在css文件中使用image-url()))。可能有什么问题,我该怎么解决?
I'm using cedar stack and this is my gemfile:
我用的是杉木栈,这是我的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
And here are the versions used by heroku:
这里是heroku使用的版本:
Using rake (0.8.7)
Using rails (3.1.0)
Using sass (3.1.15)
Using sass-rails (3.1.6)
Here's my application.rb file
这是我的应用程序。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
And here's my production.rb file
和这是我的生产。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
3 个解决方案
#1
34
I had a similar problem and found the answer here: https://github.com/rails/sass-rails/issues/78. Basically, downgrade to sass-rails v3.1.4. Hope this helps
我遇到了一个类似的问题,在这里找到了答案:https://github.com/rails/sass-rails/issues/78。基本上,降级为sass-rails v3.1.4。希望这有助于
#2
1
You shouldn't had to delete this *= require tree .
from application.css, coz it loads all you styles. just add it, and configure your config/production.rb
file like this:
你不应该删除这个*= require树。从应用程序。css,因为它会加载所有样式。只需添加它,并配置您的配置/生产。rb文件如下:
config.assets.precompile = %w{application.js}
and run RAILS_ENV=production rake assets:precompile
运行RAILS_ENV=生产rake资产:预编译
EDIT try to use this config:
编辑尝试使用这个配置:
config.assets.digest = true
#3
0
Apparently sass stopped working and I ran out of patience so I decided not to use it anymore. Instead of doing this:
显然sass停止了工作,我失去了耐心,所以我决定不再使用它。而不是这样做:
#theme.css.scss
background-image:image-url('image.png');
Now I am simply using an erb file:
现在我只是使用erb文件:
#theme.css.erb
background-image:url(<%= asset_path 'image.png' %>);
I just lost a whole day because of this and I have no idea why because it was working fine just yesterday. If somebody knows what caused this and how I can use sass again, please comment.
因为这个原因,我浪费了一整天的时间,我不知道为什么,因为就在昨天,它还能正常工作。如果有人知道是什么原因以及我如何再次使用sass,请评论。
#1
34
I had a similar problem and found the answer here: https://github.com/rails/sass-rails/issues/78. Basically, downgrade to sass-rails v3.1.4. Hope this helps
我遇到了一个类似的问题,在这里找到了答案:https://github.com/rails/sass-rails/issues/78。基本上,降级为sass-rails v3.1.4。希望这有助于
#2
1
You shouldn't had to delete this *= require tree .
from application.css, coz it loads all you styles. just add it, and configure your config/production.rb
file like this:
你不应该删除这个*= require树。从应用程序。css,因为它会加载所有样式。只需添加它,并配置您的配置/生产。rb文件如下:
config.assets.precompile = %w{application.js}
and run RAILS_ENV=production rake assets:precompile
运行RAILS_ENV=生产rake资产:预编译
EDIT try to use this config:
编辑尝试使用这个配置:
config.assets.digest = true
#3
0
Apparently sass stopped working and I ran out of patience so I decided not to use it anymore. Instead of doing this:
显然sass停止了工作,我失去了耐心,所以我决定不再使用它。而不是这样做:
#theme.css.scss
background-image:image-url('image.png');
Now I am simply using an erb file:
现在我只是使用erb文件:
#theme.css.erb
background-image:url(<%= asset_path 'image.png' %>);
I just lost a whole day because of this and I have no idea why because it was working fine just yesterday. If somebody knows what caused this and how I can use sass again, please comment.
因为这个原因,我浪费了一整天的时间,我不知道为什么,因为就在昨天,它还能正常工作。如果有人知道是什么原因以及我如何再次使用sass,请评论。