从4.2升级后捆绑w/Rails 5.0.6时出现Bundler错误



尝试将Ruby 2.2/Rays 4.2升级到Rails 5.0.6(在5.0.7.2上已经放弃了,因为它似乎需要Zeitwerk,而Zeitwer需要Ruby>=2.4.4(

Bundler could not find compatible versions for gem "actionmailer":
In Gemfile:
premailer-rails was resolved to 1.11.1, which depends on
actionmailer (>= 3)
rails (= 5.0.6) was resolved to 5.0.6, which depends on
actionmailer (= 5.0.6)

现在,我的gem文件中有gem "rails", '5.0.6',没有actionmailer的列表。actionmailer 5.0.6似乎可以满足这两个要求,那么bundler为什么会抱怨(我确实在bundle update命令中列出了actionmailer(呢?更重要的是,我能做些什么来克服这个问题?

在之前的Rails升级中,我删除了gemfile.lock并进行了bundle install,最终使其正常工作。所以我在这次升级中尝试了一下,结果却出现了同样的错误。我也尝试了bundle update --all,但也出现了同样的错误。

这是Gemfile:

source 'http://rubygems.org'
ruby '2.2.10'
gem 'rails', '5.0.6'
gem 'railties', '5.0.6'
gem 'rake', '~> 10.4.2'             # Version added when moving to RSpec 2.99
gem 'rack-cache', '1.5.1'           # Added for 'rake', '~>10.4.2'
gem 'pg', '~> 0.15.0'               # AR on 4.2 requires 0.15
# Note: must edit database.yml to include "host: local" and remove the username put there by "rails new <app> -db postgresql"
gem 'puma', '3.11.4'
gem 'rails_12factor', group: :production
gem 'sidekiq', '2.13.1', path: 'vendor/sidekiq/sidekiq-2.13.1'
gem 'sidekiq-pro', '1.2.2', path: 'vendor/sidekiq-pro/sidekiq-pro-1.2.2'
gem 'celluloid', '0.15.2'           # Added when moving to Rails 4.0.13
gem 'redis', '3.3.3'                # Added version when moving to Rails 4.0.13
gem 'redis-namespace', '1.5.2'      # Added version when moving to Rails 4.0.13
gem 'connection_pool', '2.2.0'      # Added when moving to Rails 4.0.13
# Need the following gems for sidekiq/web
gem 'slim'
# if you require 'sinatra' you get the DSL extended to Object
gem 'sinatra', :require => nil
gem 'minitest', '5.9.1'             # Added when moving to Rails 4.1.16
gem 'jeff', '~>1.2'                 # Added when moving to Rails 4.1.16
gem 'excon', '0.22.1'               # Added when moving to Rails 4.1.16
gem 'raindrops', '0.19.1'           # Added when moving to Rails 4.1.16
gem 'sprockets-rails', '~> 2.0'
gem 'sprockets', '~> 2.8'

gem 'a2z', '0.1.2'
gem 'public_suffix', '1.5.3'        # Added when moving to Rails 4.0.13
gem 'hitimes', '1.2.2'              # Added when moving to Rails 4.0.13
gem 'ffi', '1.9.6'                  # Added when moving to Rails 4.0.13
gem 'faraday', '0.8.9'              # Added when moving to Rails 4.0.13
gem 'net-http-persistent', '2.5.2'  # Added when moving to Rails 4.0.13
gem 'platform-api', '2.1.0'         # Added version when moving to Rails 4.0.13
gem 'json', '1.8.6'                 # Added version when moving to Rails 4.0.13
gem 'lograge'
gem 'oauth2', '0.9.4'
gem 'omniauth', '1.2.1'
gem 'omniauth-oauth2', '1.1.2'
gem 'omniauth-google-oauth2', '0.2.4'    # Google OAuth-2 Login via OmniAuth
gem 'jwt', '1.0.0'                  # Added when moving to Rails 4.0.13
gem 'premailer-rails'     # Converts CSS styles to inline styles, creates plain-text email from HTML email
gem 'premailer', '1.8.4'            # Added version when moving to Rails 4.0.13
gem 'psych', '2.0.5'
gem 'stripe', '1.25.0', path: 'vendor/stripe/stripe-ruby-1.25.0'
gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'uglifier', '>= 1.3.0'
gem 'mechanize', '2.7.2'            # Added version when moving to Rails 4.0.13
gem 'nokogiri', '1.6.7.2'           # Added version when moving to Rails 4.0.13
gem 'spreadsheet', '> 0.9.0'
gem 'roo', '2.5.1'                  # Added version when moving to Rails 4.0.13
gem 'roo-xls'
gem 'xml-simple'
gem 'rubyzip', '1.2.2'              # Added version when moving to Rails 4.0.13
gem 'scbi_multi_gz_reader'
gem 'rmagick', '2.15.4'             # Added version when moving to Rails 4.0.13
gem 'jquery-rails'
gem 'jquery-ui-rails'
# To use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.0'
gem 'will_paginate', '~> 3.0.0'
gem 'geoip'
gem 'byebug', '~> 10.0.0'
group :development do
gem 'web-console', '~> 2.0'
gem 'spring', '2.0.2'
end
group :test do
gem 'rspec-rails', '~> 3.1'
gem 'faker', '~> 0.3.1'
gem 'shoulda-matchers', '2.8.0'               # Added version when moving to Rails 4.0.13
gem 'capybara'                                # Switched from Webrat to Capybara w/ Rails 4.2
gem 'factory_girl_rails', '4.7.0'             # Added version when moving to Rails 4.0.13
gem 'timecop'
end
gem 'htmlentities'
gem 'retina_tag'
gem 'useragent'

以下是我解决此问题的方法。

  1. 从Gemfile中删除所有gem的版本(Ruby和Rails除外(
  2. 删除Gemfile.lock
  3. 捆绑安装

在我的案例中,我在带有本机扩展的gem上遇到了许多构建错误。大多数都与CLANG(Mac OS X C编译器(的更改有关,要求我在gem安装中添加-- --with-cflags="-Wno-error=implicit-function-declaration"

最新更新