2013-08-03 74 views
0

我試着用新添加的bootstrap部署我的rails應用程序,並且我的應用程序中的很多視圖都丟失了。Heroku沒有從Rails資產管道加載正確的Bootstrap CSS文件

這裏有一些錯誤,部署到Heroku的

 Your bundle is complete! It was installed into ./vendor/bundle 
     Cleaning up the bundler cache. 
-----> Writing config/database.yml to read from DATABASE_URL 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     rake aborted! 
     Invalid CSS after "@iconSpritePath:": expected pseudoclass or pseudoelement, was " asset-path("tw..." 
     (in /tmp/build_d0cqakcvbcp6/app/assets/stylesheets/application.css) 
     (sass):4712 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:1145:in `expected' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:1083:in `expected' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:1065:in `expr!' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:793:in `pseudo' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:671:in `simple_selector_sequence' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:639:in `_selector' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:618:in `selector' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:155:in `directive' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:552:in `block_child' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:545:in `block_contents' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:82:in `stylesheet' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/scss/parser.rb:27:in `parse' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/engine.rb:342:in `_to_tree' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/engine.rb:315:in `_render' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-3.2.10/lib/sass/engine.rb:262:in `render' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sass-rails-3.2.6/lib/sass/rails/compressor.rb:16:in `compress' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/compressors.rb:74:in `compress' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processing.rb:243:in `block in css_compressor=' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:19:in `block in compile' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:18:in `compile' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_precompile' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task' 
     /tmp/build_d0cqakcvbcp6/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>' 
     Tasks: TOP => assets:precompile:primary 
     (See full trace by running task with --trace) 
     Precompiling assets failed, enabling runtime asset compilation 
     Injecting rails31_enable_runtime_asset_compilation 
     Please see this article for troubleshooting help: 
     http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting 
-----> WARNINGS: 
     You have not declared a Ruby version in your Gemfile. 
     To set your Ruby version add this line to your Gemfile: 
     ruby '2.0.0' 
     # See https://devcenter.heroku.com/articles/ruby-versions for more information." 
-----> Rails plugin injection 
     Injecting rails_log_stdout 
     Injecting rails3_serve_static_assets 
-----> Discovering process types 
     Procfile declares types  -> (none) 
     Default types for Ruby/Rails -> console, rake, web, worker 

-----> Compiled slug size: 34.4MB 
-----> Launching... done, v11 

,當我得到了我也覺得這可能有事情做吧。運行heroku run rake db命令

Running `rake pg:reset` attached to terminal... up, run.8011 
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7) 
+0

您的評論無效,請檢查錯誤並修復。 – sevenseacat

回答

1

它不是錯誤,是警告,當我得到這個錯誤。 這就是說你有一個不再受Rails 4.0支持的插件。

0

您是使用bootstrap-sass還是sass?看來跟蹤表明sass正在將你的css解析爲scss。嘗試禁用sass:

group :assets do 
    # gem 'sass-rails', '~> 3.1.5' 
    gem 'coffee-rails', '~> 3.1.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

如果這不起作用,也許在CSS中確實存在錯誤。

編輯:棄用警告似乎與我無關。

0

看起來你可能會嘗試使用SASS文件中的ruby asset_path函數來指示iconsprite圖像的來源。

嘗試使用絕對URL代替,即「/assets/sprite_image.png」

該警告是不相關的,它是導致問題的SASS編譯器崩潰。

相關問題