ruby on Rails:未定义的方法“version_requirements”新安装后尝试启动服务器时

发布于 2024-10-21 15:55:42 字数 2499 浏览 0 评论 0原文

我最近不得不在 Rails 上新安装 ruby​​。当我尝试启动一个项目的服务器时,我在这个新安装之前就已经在处理这个项目了,我收到了以下错误:

$ ruby script/server
=> Booting WEBrick...
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:107:in `requirement': undefined method `version_requirements' for #<Gem::Dependency:0xb74bf764> (NoMethodError)
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `check_gem_dependencies'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `map'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `check_gem_dependencies'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:165:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `send'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `run'
    from /media/78C0-455B/bidmc/schedule/config/environment.rb:13
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/railties/lib/commands/servers/webrick.rb:59
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/railties/lib/commands/server.rb:49
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from script/server:3

我有最新版本的 ruby​​、rubygems 和rails。

有什么建议吗?

谢谢。

I had to newly install ruby on rails recently. When I attempted to start the server for a project I had already been working on previous to this new install, I received the following error:

$ ruby script/server
=> Booting WEBrick...
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:107:in `requirement': undefined method `version_requirements' for #<Gem::Dependency:0xb74bf764> (NoMethodError)
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `check_gem_dependencies'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `map'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `check_gem_dependencies'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:165:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `send'
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `run'
    from /media/78C0-455B/bidmc/schedule/config/environment.rb:13
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/railties/lib/commands/servers/webrick.rb:59
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /media/78C0-455B/bidmc/schedule/vendor/rails/railties/lib/commands/server.rb:49
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from script/server:3

I have the latest versions of ruby, rubygems, and rails.

Any suggestions?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新人笑 2024-10-28 15:55:42

看起来您正在使用较新版本的 ruby​​gems 和较旧版本的 Rails。

这是一个解决方案:https://gist.github.com/807008

Looks like you are using a newer version of rubygems with an older version of rails.

Here's a solution: https://gist.github.com/807008

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文