1

ruby 版本 - ruby​​ 1.9.3p0(2011-10-30 修订版 33570)[x86_64-linux]

轨道版本 - Rails 3.2.6

宝石版本 - 1.8.15

操作系统 - Ubuntu 12.04

我确实跑来sudo gem install rubygems-update -v 1.8.24更新 ruby​​gems 版本

启动rails服务器后,出现异常

/var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load': /home/work/AptanaWorkspace/ordernile/config/initializers/wrap_parameters.rb:8: syntax error, unexpected ':', expecting kEND (SyntaxError)
  wrap_parameters format: [:json]
                         ^
    from /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
    from /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/engine.rb:588
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/engine.rb:587:in `each'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/engine.rb:587
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `run_initializers'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `send'
    from /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
4

1 回答 1

2

问题描述不足以说明可能导致异常的原因。但很明显,Ruby on Rails 是在 ruby​​ 1.8 而不是 1.9 下运行的。

我的建议是:

  • 安装以下 ruby​​ 版本管理工具之一。RVMrbenv。他们将帮助您管理整个系统的 Ruby 版本,在不同项目之间切换 Ruby 版本。我个人更喜欢 rbenv,该站点列出了所有优点。

安装和配置您的项目或全局 Ruby 版本后: 1. 仔细检查您当前的 ruby​​ 版本ruby --version 2. 运行gem install bundler 3. 在项目根文件夹下运行bundle update

如果 RoR 的 Gemfile 配置正确,第二步应该可以安装所有的依赖。确保您已完成所有设置并完成数据库配置rake db:migrate

于 2012-07-06T21:25:06.973 回答