0

我刚刚在我的 Mac OSX 10.7.4 上使用 Rails 安装程序安装了 rails env。

我使用“rails new”命令创建了一个项目。

当我尝试运行“rails server”命令时,我收到以下消息:

/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:90:in `<class:Base>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:85:in `<module:Generator>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:48:in `<module:Rails>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:6:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator.rb:37:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/bin/rails:15:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/rails:23:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/rails:23:in `<main>'

当我运行 $ ruby​​ -v 和 $ gem -v 时,我分别得到“ruby 1.9.3p194”和“1.8.24”。我在这里想念什么?我怎样才能让这个服务器运行?

4

2 回答 2

4

看起来您正在尝试在 Rails 2.3 中使用 Rails 3.x 命令。Pre 3.0 你必须使用服务器脚本。

从您的应用程序目录中运行:

./script/server 
于 2012-09-02T15:34:57.020 回答
0

将导轨安装为 gem gem install rails,. 当您使用 rvm 时,此处显示的文件夹路径显示 rails 2.3.4,而您尝试运行rails server. 检查/更改 gem 文件中的 rails 版本,然后进行捆绑安装。

于 2012-09-02T15:41:49.060 回答