assets:precompile fails with “File exists” on Rails 3.2.15 with Asset Pipeline

末鹿安然 提交于 2019-12-11 02:47:40

问题


I am unable to precompile my assets for my Rails 3.2.15 asset pipeline enabled app.

Gemfile:

# Asset pipeline
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier',     '1.3.0'
end

production.rb

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  config.assets.precompile += %w( *.js *.css )

  # Choose which compressors to use
  # config.assets.js_compressor  = :uglifier
  # config.assets.css_compressor = :scss

These are the commands i run:

bundle exec rake assets:clean RAILS_ENV=production --trace
bundle exec rake assets:precompile RAILS_ENV=production --trace

And i get the following error:

** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/bin/ruby1.9.1 /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
File exists - (/media/shared/code/me/app/tmp/cache/assets/sprockets%2F19d4dbfec65d2b21144310264f4d8c7320131106-63076-sh3p6h, /media/shared/code/me/app/tmp/cache/assets/D04/B00/sprockets%2F19d4dbfec65d2b21144310264f4d8c73)
/usr/lib/ruby/1.9.1/fileutils.rb:519:in `rename'
/usr/lib/ruby/1.9.1/fileutils.rb:519:in `block in mv'
/usr/lib/ruby/1.9.1/fileutils.rb:1515:in `block in fu_each_src_dest'
/usr/lib/ruby/1.9.1/fileutils.rb:1531:in `fu_each_src_dest0'
/usr/lib/ruby/1.9.1/fileutils.rb:1513:in `fu_each_src_dest'
/usr/lib/ruby/1.9.1/fileutils.rb:508:in `mv'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.15/lib/active_support/core_ext/file/atomic.rb:36:in `atomic_write'

Only the latter file (which seems to change every time i run the command) is visible on disk, the former seems to be a temp file which is created and then moved. It is not visible after seeing the error.

Any ideas what on earth this means?

I am running Ubuntu 12.04.3 LTS, Rubygems 2.1.6, Bundler 1.3.5 and Ruby 1.9.3p429

Thanks

来源:https://stackoverflow.com/questions/19815655/assetsprecompile-fails-with-file-exists-on-rails-3-2-15-with-asset-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!