新手问题 Ubuntu 安装 ruby-china 问题求助

desert · 2012年09月18日 · 最后由 seveniruby 回复于 2012年10月14日 · 3175 次阅读

补上 最后发现是 ruby 的版本太低,不支持 mongoid

升级到 1.9.3 解决

运行以后的错误页面 运行 Shell 的截图

rake db:seed

我继续跟着

#1 楼 @huacnlee

setup.rb 执行过没有?

rake db:seed --trace 看看

不能贴图了,只能放代码、@huacnlee

·ruby@Desert:~/ruby-china$ rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:seed
rake aborted!
undefined method `[]' for nil:NilClass
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:74:in `block in command'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:522:in `[]'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:522:in `block (3 levels) in flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:521:in `map'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:521:in `block (2 levels) in flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:113:in `ensure_connected'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:517:in `block in flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:532:in `logging'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:516:in `flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:505:in `process'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:70:in `command'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:356:in `refresh'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:101:in `block in refresh'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:114:in `each'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:114:in `refresh'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:67:in `nodes'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:176:in `with_secondary'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/session/context.rb:104:in `with_node'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/session/context.rb:43:in `query'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/query.rb:108:in `first'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/mongoid-3.0.1/lib/mongoid/contextual/mongo.rb:200:in `first'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/mongoid-3.0.1/lib/mongoid/contextual.rb:18:in `first'
/home/ruby/ruby-china/app/models/site_config.rb:48:in `find_by_key'
/home/ruby/ruby-china/app/models/site_config.rb:52:in `save_default'
/home/ruby/ruby-china/db/seeds.rb:7:in `<top (required)>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:245:in `load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:245:in `block in load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:245:in `load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/mongoid-3.0.1/lib/mongoid/railties/database.rake:13:in `block (2 levels) in <top (required)>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `<main>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:seed
ruby@Desert:~/ruby-china$ ·

看不出问题额... mongoid.yml 什么的配置了么?

#7 楼 @huacnlee 貌似没有私信功能,我给你帐号和密码你看看 没有操作 mongoid.yml 只是默认然后直接 rails s 了

@Desert 请问这个问题解决了没有,我正在尝试把 rubychina 部署在 cloudfoundry,也是遇到了这个问题。怀疑是 seeds 的问题,然后我写了一个 action,可以从页面直接做 db:seeds 操作,但是发现也失败了。追查发现是:SiteConfig.save_default("index_html" ,,, 这句出现了问题,貌似是数据库中没有 index_html 字段,所以想请教下,是否在之前还有其他的初始化 mongodb 的操作? @huacnlee

#9 楼 @seveniruby 我的意见还是再检查一次版本号 我的开始就是版本的问题 包括 ruby 用的 1.92

#10 楼 @Desert 我现在使用了 linode 重新部署了。之前的错误,怀疑是 cloudfoundry 没有 nodejs 的环境

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册