UPD:问题已解决。
我将 gem twitter-bootstrap 添加到 gems 的整体列表中(不仅是 group :assets)。并且必须在部署之前进行预编译。
部署有问题。
application.css.scss
现在不存在 - 该文件已被删除。可能是什么问题?当我添加bootstrap-sass
而不是.less
版本时,问题就开始了。但它失败了,原因不明。我决定回去,现在我遇到了这些问题。
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
File to import not found or unreadable: bootstrap.
Load path: Sass::Rails::Importer(/tmp/build_3es5vmj75q0ih/app/assets/stylesheets/application.css.scss)
(in /tmp/build_3es5vmj75q0ih/app/assets/stylesheets/application.css.scss)
/tmp/build_3es5vmj75q0ih/app/assets/stylesheets/application.css.scss:16
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/import_node.rb:67:in `rescue in import'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/import_node.rb:45:in `import'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/import_node.rb:28:in `imported_file'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/import_node.rb:37:in `css_import?'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:215:in `visit_import'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/base.rb:37:in `visit'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:98:in `visit'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/base.rb:53:in `map'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/base.rb:53:in `visit_children'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:107:in `block in visit_children'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:119:in `with_environment'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:106:in `visit_children'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/base.rb:37:in `block in visit'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:126:in `visit_root'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/base.rb:37:in `visit'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:98:in `visit'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/visitors/perform.rb:7:in `visit'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/tree/root_node.rb:20:in `render'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/engine.rb:315:in `_render'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-3.2.3/lib/sass/engine.rb:262:in `render'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sass-rails-3.2.5/lib/sass/rails/template_handlers.rb:106:in `evaluate'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/context.rb:177:in `block in evaluate'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in `each'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in `evaluate'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:12:in `initialize'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `new'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `block in build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:262:in `circular_call_protection'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:240:in `build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in `block in build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:in `cache_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:106:in `block in build_required_assets'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:100:in `each'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:100:in `build_required_assets'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `new'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `block in build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:262:in `circular_call_protection'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:240:in `build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in `block in build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:in `cache_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:244:in `new'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:244:in `build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in `block in build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:in `cache_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/static_compiler.rb:20:in `block in compile'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:212:in `block in each_logical_path'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:200:in `block (2 levels) in each_file'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each_entry'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:198:in `block in each_file'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each_file'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:210:in `each_logical_path'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/static_compiler.rb:18:in `compile'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/assets.rake:56:in `internal_precompile'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
/tmp/build_3es5vmj75q0ih/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/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
-----> 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: 15.9MB
-----> Launching... done, v14
在Heroku日志中,我有:
2012-11-23T01:34:01+00:00 app[web.1]: => Rails 3.2.2 application starting in production on http://0.0.0.0:4868
2012-11-23T01:34:01+00:00 app[web.1]: => Call with -d to detach
2012-11-23T01:34:01+00:00 app[web.1]: Processing by SearchesController#new as HTML
2012-11-23T01:34:02+00:00 app[web.1]: Rendered searches/new.html.haml within layouts/application (707.1ms)
2012-11-23T01:34:03+00:00 app[web.1]: Completed 500 Internal Server Error in 1694ms
2012-11-23T01:34:03+00:00 app[web.1]:
2012-11-23T01:34:03+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2012-11-23T01:34:03+00:00 app[web.1]: Load path: /app
2012-11-23T01:34:03+00:00 app[web.1]: 4: %title
2012-11-23T01:34:03+00:00 app[web.1]: 5: Seopositions
2012-11-23T01:34:03+00:00 app[web.1]: 6: = stylesheet_link_tag "application", :media => "all"
2012-11-23T01:34:03+00:00 app[web.1]: (in /app/app/assets/stylesheets/application.css.scss)):
2012-11-23T01:34:03+00:00 app[web.1]:
2012-11-23T01:34:03+00:00 app[web.1]: app/assets/stylesheets/application.css.scss:16
2012-11-23T01:34:03+00:00 app[web.1]: app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml__2436706826874996932_32759700'
2012-11-23T01:34:03+00:00 app[web.1]: cache: [GET /] miss
2012-11-23T01:34:03+00:00 app[web.1]: 8: = csrf_meta_tags
2012-11-23T01:34:03+00:00 app[web.1]: 3: %head
2012-11-23T01:34:03+00:00 app[web.1]: 7: = javascript_include_tag "application"
2012-11-23T01:34:03+00:00 app[web.1]: 9: %body
2012-11-23T01:34:03+00:00 app[web.1]:
2012-11-23T01:34:03+00:00 heroku[router]: at=info method=GET path=/ host=seopositions-2.herokuapp.com fwd= dyno=web.1 queue=0 wait=2ms connect=5ms service=1939ms status=500 bytes=643
2012-11-23T01:34:04+00:00 app[web.1]: cache: [GET /favicon.ico] miss
2012-11-23T01:34:04+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=seopositions-2.herokuapp.com fwd= dyno=web.1 queue=0 wait=0ms connect=3ms service=9ms status=200 bytes=0