简体   繁体   中英

Rails 3.2.8 - Precompiling Assets Fails

I'm upgrading an app from Rails 3.0.3 to 3.2.8. Trying to get the assets to precompile. I get this output:

$ bundle exec rake assets:precompile
/usr/local/rvm/rubies/ruby-1.9.2-p320/bin/ruby /usr/local/rvm/gems/ruby-1.9.2-p320@pier-admin-32/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
no such file to load -- sass/rails/compressor
  (in /home/danb/Documents/Projects/pier-admin/pier-admin/app/assets/stylesheets/application.css)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.2-p320/bin/...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

Being relatively new to this I'm at a loss as to what the problem is. I was not using assets before, and I tried to do the bare minimum during the upgrade. The app works in development. Any help would be appreciated.

Asset group is:

group :assets do
  gem 'sass'
  gem 'coffee-script'
  gem 'uglifier'
end

application.css has only

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new file per style scope.
 *= require_self
 *= require_tree . 
*/

The :assets group won't install in production so you're probably missing those gems and the rake fails.

One option is to precompile in development, commit the files in /public and push them up to the production server.

Another is to lazily initialize assets in application.rb like:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM