gpt4 book ai didi

ruby-on-rails - 无法加载此类文件 -- unicorn/version (LoadError)

转载 作者:太空宇宙 更新时间:2023-11-03 16:02:30 27 4
gpt4 key购买 nike

尝试从 WEBrick 切换到 Unicorn,我已经在我的机器上安装了 Unicorn gem v 4.8.1 [通过“gem install unicorn”],它也位于我的 Gemfile [“gem “unicorn””,“~ > 4.8.1"],我已成功运行 bundle install。

但是,当通过“rails s”(在 Unicorn 之前运行良好)在本地启动服务器时,出现以下错误:

...../vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn/const.rb:44:in `require': cannot load such file -- unicorn/version (LoadError)
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn/const.rb:44:in `<top (required)>'
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn.rb:108:in `require'
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn.rb:108:in `<top (required)>'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/johndoe/Sites/my_app/config/application.rb:7:in `<top (required)>'
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我想这可能是因为使用了 RVM?当我输入“which gem “unicorn””时,我得到:

/Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/bin/gem
/Users/johndoe/.rvm/gems/ruby-1.9.3-p392/bin/unicorn

也供引用,我的 $PATH: /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/bin/gem:/usr/local/rvm/bin:/Users/joh‌ ndoe/.rvm/gems/ruby-1.9.3-p392/bin:/Users/johndoe/.rvm/gems/ruby-1.9.3-p392@globa‌ l/bin:/Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/johndoe/.rvm/bin:/usr‌/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin

“bundle show unicorn”给出:/Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1

应用程序已成功部署到 Heroku,因此我相信此问题与我的机器无关(而不是应用程序的问题)。关于如何解决这个问题的任何想法?

最佳答案

我似乎通过“sudo bundle exec gem uninstall unicorn”卸载 gem 解决了这个问题,然后通过标准的“sudo bundle install”重新安装它

仍然不确定问题发生的确切原因,但该修复似乎确实有效。

关于ruby-on-rails - 无法加载此类文件 -- unicorn/version (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21523323/

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