我不斷收到activemodel的不兼容問題。目前的錯誤是;開發新的webapp Rails MongoDB
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
- 蒙戈版本:3.2.6
在另一個但類似的線,我把我的webapp不活躍記錄,也卸載寶石,但它似乎總是在我的gem文件中重現。
在創建我的web應用程序 -
rails new test-app --skip-active-record --skip-test-unit
的Gemfile:
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以後的版本 - 請參閱https://jira.mongodb.org/browse/MONGOID-3870 – dmitryro
我更改了gemfile,但錯誤是不同的 - 上面給出的結果。 – user44552
您可以省略明確指定gem版本,讓bundler抓取最合適的版本。或者,您需要探索依賴關係鏈以確保沒有版本衝突。 – dmitryro