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
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
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
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?
Thanks