多个 Ruby-on-Rails 项目的问题

发布于 2024-08-19 10:55:33 字数 1544 浏览 5 评论 0原文

我使用 NetBean 6.8 创建了一个 Ruby-on-Rails 项目,该项目在端口 3000 上按预期运行。

我在 NetBeans IDE 中创建了第二个 RoR 项目来试验一些想法;它在端口 3010 上运行。不幸的是,网络服务器无法启动。它返回以下内容:

/Library/Ruby/Site/1.8/rubygems.rb:827:in `report_activate_error': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (Gem::LoadError)
    from /Library/Ruby/Site/1.8/rubygems.rb:261:in `activate'
    from /Library/Ruby/Site/1.8/rubygems.rb:68:in `gem'
    from /Users/craibuc/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller.rb:34
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from /Users/craibuc/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /Users/craibuc/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:2
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3

如果我也尝试在 Ruby 提示符下启动应用程序,则会出现此行为。

环境:OSX、NetBeans 6.8、Ruby 1.8.7、Rails 2.3.5、Mongrel 1.1.5、MySQL 5.1.42

我假设可以运行多个 RoR 应用程序,尽管它们在不同的端口上。我说得对吗?如果是这样,我错过了什么?

顺便说一句,将在 Ruby 提示符下创建的现有 RoR 应用程序添加到 NetBeans IDE 的过程是什么?

I created a Ruby-on-Rails project using NetBean 6.8, which operates as expected on port 3000.

I created a second RoR project in the NetBeans IDE to experiment with some ideas; it operates on port 3010. Unfortunately, the webserver won't start. It returns the following:

/Library/Ruby/Site/1.8/rubygems.rb:827:in `report_activate_error': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (Gem::LoadError)
    from /Library/Ruby/Site/1.8/rubygems.rb:261:in `activate'
    from /Library/Ruby/Site/1.8/rubygems.rb:68:in `gem'
    from /Users/craibuc/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller.rb:34
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from /Users/craibuc/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /Users/craibuc/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:2
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3

This behavior occurs if I attempt to start the application at the Ruby prompt as well.

Environment: OSX, NetBeans 6.8, Ruby 1.8.7, Rails 2.3.5, Mongrel 1.1.5, MySQL 5.1.42

I'm assuming that one can have multiple RoR applications running, albeit on different ports. Am I correct? If so, what am I missing?

Incidentally, what is the process to add an existing RoR application, created at the Ruby prompt, to the NetBeans IDE?

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

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

发布评论

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

评论(1

殊姿 2024-08-26 10:55:33

该错误表明您没有安装所需版本的rack gem - 您拥有版本1.0.0,但Rails 2.3.5需要版本1.0.1。您可以通过运行以下命令来安装版本 1.0.1:

gem install rack --version 1.0.1

在不同端口上运行多个 Rails 应用程序没有问题。您的应用程序在端口 3000 上正在运行,因为它可能使用早期版本的 Rails。 2.3.4 版本依赖于 Rack 1.0.0 版本。检查 config/environment.rb 中的 RAILS_GEM_VERSION 值,了解您正在使用的 Rails 版本。

The error is saying you don't have the required version of the rack gem installed - you have version 1.0.0, but Rails 2.3.5 requires version 1.0.1. You can install version 1.0.1 by running:

gem install rack --version 1.0.1

There is no problem with running multiple Rails applications on different ports. Your application on port 3000 is working because it is probably using an earlier version of Rails. Version 2.3.4 depended on version 1.0.0 of Rack. Check the value of RAILS_GEM_VERSION in config/environment.rb to see what version of Rails you are using.

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