【发布时间】:2016-07-08 03:58:39
【问题描述】:
我不断收到 activemodel 的不兼容问题。当前的错误是;
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
mongoid (~> 4.0.0) was resolved to 4.0.0, which depends on
activemodel (~> 4.0)
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
我目前的版本是;
- Rails 5.0.0
- 红宝石 2.2.2p95
- Mongo 版本:3.2.6
在另一条类似的行中,我将我的 webapp 设置为没有活动记录,并且还卸载了 gem,但它似乎总是在我的 gemfile 中重新出现。
在创建我的 web 应用时 -
rails new test-app --skip-active-record --skip-test-unit
宝石文件:
source 'https://rubygems.org'
gem 'rails', '~> 5.0.0'
group :assets do
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
end
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Mongo linker
gem 'mongoid', git: 'https://github.com/estolfo/mongoid.git'
# Turbolinks makes navigating web application faster.
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
gem 'quiet_assets'
end
#Rspec for unit testing
gem "rspec-rails", :group => [:development, :test]
gem 'figaro'
gem "capybara", :group => :test
gem "database_cleaner", :group => :test
gem "mongoid-rspec", :group => :test
gem "email_spec", :group => :test
gem "cucumber-rails", :group => :test, :require => false
gem "launchy", :group => :test
gem "factory_girl_rails", :group => [:development, :test]
gem "devise"
gem 'therubyracer', platforms: :ruby
一旦我专门更改了我的 Gemfile,mongoid
gem 'mongoid', git: 'https://github.com/estolfo/mongoid.git', branch: 'MONGOID-4218-rails-5'
错误来了-
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
mongoid was resolved to 6.0.0, which depends on
activemodel (= 5.0.0.beta3) was resolved to 5.0.0.beta3, which depends on
activesupport (= 5.0.0.beta3)
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activesupport (= 5.0.0)
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activesupport (= 5.0.0)
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activesupport (= 5.0.0)
【问题讨论】:
-
看起来你的 mongoid 必须是更高版本的 5.1.0 - 请参阅 jira.mongodb.org/browse/MONGOID-3870
-
我更改了 gemfile 但错误不同 - 结果如上所示。
-
您可以省略明确指定 gem 版本,让 bundler 抓取最合适的版本。或者,您需要探索依赖链以确保没有版本冲突。
-
你的 Gemfile 中有一些东西让我感到困惑:你为什么要使用官方 mongoid 存储库的 fork 来安装 gem?
标签: ruby-on-rails ruby mongodb web-applications