ruby on Rails:未定义的方法“version_requirements”新安装后尝试启动服务器时
我最近不得不在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在使用较新版本的 rubygems 和较旧版本的 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