【发布时间】:2023-11-30 19:40:01
【问题描述】:
我是 ROR 和 mongodb 的新手,但对 linux 有一定的了解, 当我尝试在我的 ruby on rails 上设置 mongodb 时,我正在遵循本指南:
当我在“运行测试”时,我运行了命令:
rake test
我收到了这个错误:
rake aborted!
You have already activated bson 1.4.0, but your Gemfile requires bson 1.3.1. Using bundle exec may solve this.
(See full trace by running task with --trace)
我试图通过互联网搜索类似的问题,我能得到的最好的是:
Error: You have already activated bson 1.3.1, but your Gemfile requires bson 1.2.4.
我试图按照两种方式卸载它提供的 bson 1.4.0 版:
rake aborted!
Could not find bson (= 1.4.0) amongst [actionmailer-3.1.1, actionpack-3.1.1, activemodel-3.1.1, activerecord-3.1.1, activeresource-3.1.1, activesupport-3.1.1, arel-2.2.1, bson-1.3.1, bson_ext-1.4.0, bson_ext-1.3.1, builder-3.0.0, bundler-1.0.21, coffee-rails-3.1.1, coffee-script-2.2.0, coffee-script-source-1.1.2, erubis-2.7.0, execjs-1.2.9, hike-1.2.1, i18n-0.6.0, jquery-rails-1.0.16, json-1.6.1, mail-2.3.0, mime-types-1.17.2, mime-types-1.16, mongo-1.4.0, mongo-1.3.1, mongo_mapper-0.10.0, mongoid-2.3.3, multi_json-1.0.3, plucky-0.3.8, polyglot-0.3.3, polyglot-0.3.2, rack-1.3.5, rack-cache-1.1, rack-mount-0.8.3, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.1.1, railties-3.1.1, rake-0.9.2.2, rake-0.9.2, rdoc-3.11, sass-3.1.10, sass-rails-3.1.4, sprockets-2.0.3, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.30, uglifier-1.0.4]
(See full trace by running task with --trace)
我试图在 config/environment.rb 的开头附加这些行:
require 'yaml'
YAML::ENGINE.yamler= 'syck'
但是没有用。
我安装了 gem1.8 和 gem1.9.1
gem1.8 list
返回:
*** LOCAL GEMS ***
actionmailer (3.1.1)
actionpack (3.1.1)
activemodel (3.1.1)
activerecord (3.1.1)
activeresource (3.1.1)
activesupport (3.1.1)
arel (2.2.1)
bson (1.4.0, 1.3.1)
bson_ext (1.4.0, 1.3.1)
builder (3.0.0)
bundler (1.0.21)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
erubis (2.7.0)
execjs (1.2.9)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.16)
json (1.6.1)
mail (2.3.0)
mime-types (1.17.2, 1.16)
mongo (1.4.0, 1.3.1)
mongo_mapper (0.10.0)
mongoid (2.3.3)
multi_json (1.0.3)
plucky (0.3.8)
polyglot (0.3.3, 0.3.2)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.1)
railties (3.1.1)
rake (0.9.2.2, 0.9.2)
rdoc (3.11)
sass (3.1.10)
sass-rails (3.1.4)
sprockets (2.0.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.30)
uglifier (1.0.4)
我已经完成了:
gem1.8 install mongoid
gem1.8 install mongo_mapper
gem1.8 install mongo
gem1.8 install bson
gem1.8 install bson_ext
请告诉我应该如何进行?
【问题讨论】:
-
rails 是通过 rubygems 还是 apt-get 安装的?
标签: ruby-on-rails ruby ruby-on-rails-3 gem ubuntu-11.04