gpt4 book ai didi

ruby-on-rails - 抽取 Assets :precompile cannot find ruby

转载 作者:太空宇宙 更新时间:2023-11-03 17:24:10 25 4
gpt4 key购买 nike

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

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,但事实并非如此:

$ 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 ,如下所示。我从上面显示的错误中得到了这样做的想法。这很奇怪,因为这似乎是导致问题的原因。但是手动运行它是可行的。

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

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

谢谢

最佳答案

我遇到了同样的问题。我通过恢复到 ruby​​-1.9.3-p392 修复了它,此时我收到了一个关于可执行 Hook 的错误,这让我想到了这个问题。然后我跑了:

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

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

我原来的问题在这里:rake assets:precompile error message: No such file or directory -- ruby

关于ruby-on-rails - 抽取 Assets :precompile cannot find ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18968583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com