Ruby on rails Rails:资源预编译失败

Ruby on rails Rails:资源预编译失败,ruby-on-rails,linux,ruby-on-rails-3,rake,asset-pipeline,Ruby On Rails,Linux,Ruby On Rails 3,Rake,Asset Pipeline,在我的一台linux服务器上运行时 bundle exec rake assets:precompile RAILS_ENV=production --trace 我得到以下错误 ** Invoke assets:precompile (first_time) ** Execute assets:precompile /usr/local/bin/ruby /srv/www/example.com/shared/bundle/ruby/1.9.1/bin/rake assets:precom

在我的一台linux服务器上运行时

 bundle exec rake assets:precompile RAILS_ENV=production --trace
我得到以下错误

** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/bin/ruby /srv/www/example.com/shared/bundle/ruby/1.9.1/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!
Command failed with status (): [/usr/local/bin/ruby /srv/www/example.com/s...]
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils.rb:45:in `call'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils.rb:45:in `sh'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils_ext.rb:40:in `sh'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils.rb:80:in `ruby'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils_ext.rb:40:in `ruby'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/srv/www/example.com/shared/bundle/ruby/1.9.1/bin/rake:23:in `load'
/srv/www/example.com/shared/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
**调用资产:预编译(第一次)
**执行资产:预编译
/usr/local/bin/ruby/srv/www/example.com/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS\u ENV=production RAILS\u GROUPS=assets--trace
**调用资产:预编译:全部(第一次)
**执行资产:预编译:全部
**调用资产:预编译:主(第一次)
**调用资产:环境(第一次)
**执行资产:环境
**调用环境(第一次)
**执行环境
**调用tmp:cache:clear(第一次)
**执行tmp:cache:clear
**执行资产:预编译:主
雷克流产了!
命令失败,状态为():[/usr/local/bin/ruby/srv/www/example.com/s..]
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils.rb:53:in`block in create_shell_runner'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_-utils.rb:45:in'call'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_-utils.rb:45:in'sh'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils_ext.rb:40:in'sh'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_-utils.rb:80:in`ruby'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_utils_ext.rb:40:in`ruby'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:12:in'ruby_rake_task'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:21:invoke\u或reboot\u rake\u task中
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:in“block(2层)in”
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in'call'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in'block in execute'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in'each'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in'execute'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in“block in invoke_with_call_chain”
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in'mon_synchronize'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in'invoke_with_call_chain'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:in'invoke'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in“invoke_task”
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:在“顶层的块(2层)”中
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in'each'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:在“顶层块”中
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:“使用线程运行”
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:“顶级”
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:“运行中的块”
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:在“标准异常处理”中
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in'run'
/srv/www/example.com/shared/bundle/ruby/1.9.1/gems/rake-10.0.3/bin/rake:33:in`'
/srv/www/example.com/shared/bundle/ruby/1.9.1/bin/rake:23:in'load'
/srv/www/example.com/shared/bundle/ruby/1.9.1/bin/rake:23:in`'

我使用的是Rails 3.2.11,我尝试过挖掘rake代码,但我不是rake专家。有人经历过这种情况吗?不确定如何调试?谢谢。

当RAM不足且进程使用太多RAM时,内核会主动终止进程。我将服务器切换到开发模式(因为它是一个测试服务器),暂时跳过资产预编译部分及其功能。

执行命令时,您确定您位于正确的项目文件夹中吗?是的,否则它会说找不到gemfile。很抱歉,将所有的www/example.com弄糊涂了一会儿,但这就是您的gems所在的位置。你能试着在你的
config/application.rb
上添加
config.assets.initialize\on\u precompile=false
(假设你没有)并再次运行该命令吗?嗯,你争了那个文件并添加了那一行,然后运行了该命令,你在github上也犯了同样的错误吗?如果可能的话,你能为这个问题提供你的github链接吗?使用源代码?