耙资产:预编译找不到红宝石 [英] Rake assets:precompile cannot find ruby

查看:56
本文介绍了耙资产:预编译找不到红宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个 Ruby on Rails 生产环境.我正在使用 RVM 的多用户安装.运行 rake assets:precompile 时出现以下错误.其他 rake 任务似乎工作正常.

I'm setting up a Ruby on Rails production environment. I'm using a multi user install of RVM. When running rake assets:precompile I get the following error. Other rake tasks seem to work fine.

ruby@myserver:/sites/rails/necura_staging/shared/cached-copy$ bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby ruby /usr/local/rvm/gems/ruby-1.9.3-p448@global/bin/rake assets:precompile --trace assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby: No such file or directory -- ruby /usr/local/rvm/gems/ruby-1.9.3-p448@global/bin/rake assets:precompile --trace (LoadError)
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/...]
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/file_utils.rb:55:in `block in create_shell_runner'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in `sh'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:37:in `sh'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/file_utils.rb:82:in `ruby'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:37:in `ruby'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.11/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.11/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p448@global/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:14:in `<main>'
Tasks: TOP => assets:precompile

该错误似乎表明未找到 Ruby,但事实并非如此:

The error seems to suggest that Ruby is not found but this is not the case:

$ ls /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/rub

此外,我可以在通过 ruby​​ 使用 rake 时成功运行 assets:precompile,如下所示.我从上面显示的错误中得到了这样做的想法.这很奇怪,因为这似乎是导致问题的原因.但是手动运行它是可行的.

Furthermore, I can successfully run assets:precompile when using rake through ruby as shown below. I got the idea of doing this out of the error shown above. This is strange because that is what seems to cause the problem. But running it manually works.

$ ruby /usr/local/rvm/gems/ruby-1.9.3-p448@global/bin/rake assets:precompile RAILS_ENV=staging

知道这是为什么吗?这可能与我使用多用户或全局安装 RVM 的事实有关吗?

Any ideas why this is? Could this have something to do with the fact that I'm using a multi user or global install of RVM?

谢谢

推荐答案

我遇到了同样的问题.我通过恢复到 ruby​​-1.9.3-p392 来修复它,此时我收到了关于可执行挂钩的错误,这导致我提出了这个问题.然后我跑了:

I had the same problem. I fixed it by reverting to ruby-1.9.3-p392 at which point I got an error about executable-hooks, which lead me to this question. I then ran:

rvm ruby-1.9.3-p392@global do gem install executable-hooks

基于 mpapis 的回答(谢谢!),现在一切似乎都对我有用.

based on mpapis answer (thanks for that!) and everything seems to be working for me now.

我的原始问题在这里:耙资产:预编译错误信息:没有那个文件或目录 -- ruby​​

这篇关于耙资产:预编译找不到红宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆