【问题标题】:rails g mongoid config errorrails g mongoid 配置错误
【发布时间】:2012-08-02 17:46:23
【问题描述】:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
    Master:blog shaunstanislaus$ bundle update
    Fetching gem metadata from https://rubygems.org/.........
    Fetching gem metadata from https://rubygems.org/..
    Enter your password to install the bundled RubyGems to your system: 
    Using rake (0.9.2.2) 
    Enter your password to install the bundled RubyGems to your system: 
    Using i18n (0.6.0) 
    Using multi_json (1.3.6) 
    Using activesupport (3.2.6) 
    Using builder (3.0.0) 
    Using activemodel (3.2.6) 
    Using erubis (2.7.0) 
    Using journey (1.0.4) 
    Using rack (1.4.1) 
    Using rack-cache (1.2) 
    Using rack-test (0.6.1) 
    Using hike (1.2.1) 
    Using tilt (1.3.3) 
    Using sprockets (2.1.3) 
    Using actionpack (3.2.6) 
    Using mime-types (1.19) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.10) 
    Using mail (2.4.4) 
    Using actionmailer (3.2.6) 
    Using arel (3.0.2) 
    Using tzinfo (0.3.33) 
    Using activerecord (3.2.6) 
    Using activeresource (3.2.6) 
    Using bson (1.6.4) 
    Using bson_ext (1.6.4) 
    Using bundler (1.1.5) 
    Using coffee-script-source (1.3.3) 
    Using execjs (1.4.0) 
    Using coffee-script (2.2.0) 
    Using rack-ssl (1.3.2) 
    Using json (1.7.4) 
    Using rdoc (3.12) 
    Using thor (0.15.4) 
    Using railties (3.2.6) 
    Using coffee-rails (3.2.2) 
    Using jquery-rails (2.0.2) 
    Using mongo (1.0.9) 
    Using will_paginate (3.0.3) 
    Using mongoid (2.0.0.beta.19) 
    Using rails (3.2.6) 
    Using sass (3.1.20) 
    Using sass-rails (3.2.5) 
    Using sqlite3 (1.3.6) 
    Using uglifier (1.2.7) 
    Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is                         installed.
    Master:blog shaunstanislaus$ rails g mongoid:config
    /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configuration.rb:85:in

method_missing': undefined methodgenerators' 代表#
(无方法错误) 来自 /Library/Ruby/Gems/1.8/gems/mongoid-2.0.0.beta.19/lib/mongoid/railtie.rb:13 来自 /Library/Ruby/Gems/1.8/gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89:in require' from /Library/Ruby/Gems/1.8/gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89 from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in require' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in each' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in each' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:119:in require' 来自 /Users/shaunstanislaus/Desktop/code/blog/config/application.rb:7 来自 /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24:in require' from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24 from script/rails:6:inrequire' 来自脚本/rails:6

我该如何解决这个问题?

我输入了这个命令,上面出现了错误。

大师:博客 shaunstanislaus$ rails g mongoid:config

我已经尝试删除 gemfile.loc 捆绑安装 rails g mongoid:config,再次出现此错误。还是一样。

Master:blog shaunstanislaus$ rails g mongoid:config

/Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in require': /Library/Ruby/Gems/1.8/gems/mongoid-3.0.3/lib/mongoid.rb:148: odd number list for Hash (SyntaxError) { to: Config })) ^ /Library/Ruby/Gems/1.8/gems/mongoid-3.0.3/lib/mongoid.rb:148: syntax error, unexpected ':', expecting '}' { to: Config })) ^ from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:inrequire' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in each' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:inrequire' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in each' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:inrequire' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:119:in require' from /Users/shaunstanislaus/Desktop/code/blog/config/application.rb:7 from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24:inrequire' 来自 /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24 来自脚本/rails:6:in `require' 来自脚本/rails:6

【问题讨论】:

  • 删除您的 GemFile.lock,运行捆绑安装。如果您在最新版本的 Rails (3.2?) 和 Ruby (1.9.3-p###) 上运行,它应该可以工作。看看这个:stackoverflow.com/questions/10477182/…

标签: ruby-on-rails-3 rubygems gem mongoid


【解决方案1】:

删除您的 GemFile.lock,运行捆绑安装。如果您在最新版本的 Rails (3.2?) 和 Ruby (1.9.3-p###) 上运行,它应该可以工作。

未显示 Mongoid 的“生成器”命令的原因很可能是 gem 没有为您拥有的 rails 和 ruby​​ 版本正确安装。

看看这个:Rails g failing for mongoid commands… – Dominic Tancredi 2

【讨论】:

    【解决方案2】:

    我已经设置好了

    红宝石-v

    ruby 1.9.3p194(2012-04-20 修订版 35410)[x86_64-darwin12.0.0]

    捆绑-v

    捆绑器版本 1.1.5

    捆绑安装成功; rake server 仍然报错

    /Users/avaranovich/.gem/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require': /Users/avaranovich/.gem/gems/mongoid-3.0.4/ lib/mongoid.rb:148: 哈希奇数列表 (SyntaxError) { to: 配置 }))

    【讨论】:

      【解决方案3】:

      我通过输入 bundle exec rails g mongoid:config 解决了这个问题

      【讨论】:

        猜你喜欢
        • 2015-04-30
        • 2021-04-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-02-13
        • 1970-01-01
        • 2012-09-02
        相关资源
        最近更新 更多