0

我正在使用 rails 3.2.3,当我运行 bundle exec rake assets:precompile 时,它​​失败并显示以下跟踪:

bundle exec rake assets:precompile --trace

** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/harish/.rvm/rubies/ruby-1.8.7-p352/bin/ruby /home/harish/.rvm/gems/ruby-1.8.7-p352/bin/bundler_wrapper assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
/home/harish/.rvm/gems/ruby-1.8.7-p352/bin/bundler_wrapper:22:in `read': No such file or directory - assets:precompile:all (Errno::ENOENT)
    from /home/harish/.rvm/gems/ruby-1.8.7-p352/bin/bundler_wrapper:22
rake aborted!
Command failed with status (1): [/home/harish/.rvm/rubies/ruby-1.8.7-p352/b...]
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `create_shell_runner'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/actionpack-3.2.3/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/actionpack-3.2.3/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/actionpack-3.2.3/lib/sprockets/assets.rake:29
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/home/harish/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/harish/.rvm/gems/ruby-1.8.7-p352/gems/rake-0.9.2.2/bin/rake:33
/home/harish/.rvm/gems/ruby-1.8.7-p352/bin/rake:19:in `load'
/home/harish/.rvm/gems/ruby-1.8.7-p352/bin/rake:19
/home/harish/.rvm/gems/ruby-1.8.7-p352/bin/bundler_wrapper:22
Tasks: TOP => assets:precompile

它正在尝试查找文件“assets:precompile:all”。当我创建一个名为“assets:precompile:all”的虚拟文件时,它运行成功但没有做任何事情。有人可以帮我解决这个问题吗?

4

2 回答 2

2

问题出在 rake 0.9.2.2 上。重新安装 rake 0.9.2.2 解决了这个问题。

于 2012-05-14T07:04:39.673 回答
1

我也遇到了这个问题,我通过执行以下操作解决了它:

打开config/environments/production.rb并确保将以下选项设置为true

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

然后运行:

rake assets:precompile --trace RAILS_ENV=production
于 2012-05-13T18:22:36.457 回答