1
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 method#
(NoMethodError) 的生成器来自 /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 需要'来自 /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 来自 /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:in需要'来自脚本/rails:6

我该如何解决?

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

Master:blog shaunstanislaus$ rails g mongoid:config

我已经尝试删除 gemfile.loc bundle install 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:inrequire' 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:in来自 /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24 来自脚本/rails:6:in 'require' 来自脚本/rails:6

4

3 回答 3

0

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

于 2012-09-05T22:05:07.027 回答
0

我有这个设置

红宝石-v

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

捆绑-v

捆绑器版本 1.1.5

捆绑安装成功;rake 服务器仍然给出错误

/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: Config }))

于 2012-08-22T08:44:30.257 回答
0

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

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

看看这个:Rails g 对 mongoid 命令失败...... – Dominic Tancredi 2

于 2012-08-06T03:35:44.063 回答