0

我尝试使用新添加的引导程序部署我的 rails 应用程序,但我的应用程序中的很多视图都丢失了。

这是我在部署到 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)
4

3 回答 3

1

它不是错误,而是警告。这表示您有 Rails 4.0 不再支持的插件。

于 2013-08-03T07:18:20.980 回答
0

看起来您可能正在尝试使用 SASS 文件中的 ruby​​asset_path 函数来指示图标精灵图像的来源。

尝试使用绝对网址,即“/assets/sprite_image.png”

警告是不相关的,它是导致问题的 SASS 编译器崩溃。

于 2014-09-17T03:52:01.563 回答
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中可能确实存在错误。

编辑:弃用警告似乎与我无关。

于 2013-09-19T03:10:49.420 回答