为什么资产没有预先设置RAILS_ENV?

时间:2015-09-24 18:27:49

标签: ruby-on-rails ruby ruby-on-rails-4 sass

我几乎浏览了网络上的每篇文章来解决这个问题,到目前为止没有任何帮助。 这是最新发生的事情。

我使用capistrano来部署我的应用程序,一切都很好,直到昨天。无论如何,我无法预编译我的资产。

因此,当我在prod服务器上进行rake assets:precompile本地检查资产是否正在进行预编译时,一切正常。

然而,当我RAILS_ENV=production rake assets:precompile时,它失败了。我试过不同的环境,但除了省略RAILS_ENV之外没有任何结果。我面临的问题是我的最新变化并没有反映在生产中。

这是错误的痕迹

I, [2015-09-24T23:39:05.138170 #6733]  INFO -- : Writing  /home/pamio/dev/rails_apps/remote/valutme- storefront/public/assets/high_voltage/pages- 77d20ed7f226268c100e527b51cf0830.js
I, [2015-09-24T23:39:05.232937 #6733]  INFO -- : Writing /home/pamio/dev/rails_apps/remote/valutme-storefront/public/assets/home-77d20ed7f226268c100e527b51cf0830.js
I, [2015-09-24T23:39:05.458718 #6733]  INFO -- : Writing 
 ......................
rake aborted!
Sass::SyntaxError: Invalid CSS after "...content: "\f105": expected " {", was "";"
(in /home/pamio/dev/rails_apps/remote/valutme- storefront/app/assets/stylesheets/admin.css.erb)
(sass):9628
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass- 3.4.10/lib/sass/scss/parser.rb:1165:in `expected'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:1101:in `expected'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:1096:in `tok!'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:641:in `block'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:711:in `declaration_or_ruleset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:661:in `block_child'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:653:in `block_contents'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:642:in `block'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:635:in `ruleset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:660:in `block_child'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:653:in `block_contents'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:117:in `stylesheet'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/scss/parser.rb:42:in `parse'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/engine.rb:393:in `_to_tree'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sass-3.4.10/lib/sass/engine.rb:268:in `render'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/sass_compressor.rb:24:in `evaluate'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets- 2.12.3/lib/sprockets/context.rb:194:in `each'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:25:in `initialize'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
/home/pamio/.rvm/gems/ruby-2.1.1/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
/home/pamio/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/pamio/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

此外,rake assets:precompile的默认rails环境是什么?如果默认值为production,那么它在提供显式环境参数时也应该有效。

有谁能让我知道发生了什么?

提前致谢。

1 个答案:

答案 0 :(得分:-1)

你试过跑步吗?

rake assets:clean RAILS_ENV=production    
rake assets:clobber RAILS_ENV=production