简体   繁体   中英

Bundler install - could not find compatible versions for gem "actionpack" - Rails 5

I'm trying to set up ruby on rails to start studying it but I keep getting this error when I run bundle install.

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    rails (~> 5.2.0) was resolved to 5.2.0, which depends on
      actionpack (= 5.2.0)

    simple_form (~> 3.0.2) was resolved to 3.0.4, which depends on
      actionpack (~> 4.0)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    rails (~> 5.2.0)

Could not find gem 'rails (~> 5.2.0)' in any of the sources.

My Gemfile is this:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

gem 'rails', '~> 5.2.0'
gem 'sqlite3'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'devise', '~> 3.4.1'
gem 'simple_form', '~> 3.0.2'
gem 'haml', '~> 4.0.5'

gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  gem 'chromedriver-helper'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Can somebody help me out? I'm really new to rails, in fact I'm trying to start learning it, so I have no clue on how to solve this.

The problem is that devise and simple_form gems are outdated and not compatible with the current version of rails.

You could try to install newer versions like this:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

gem 'rails', '~> 5.2.0'
gem 'sqlite3'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'devise', '~> 4.5.0'
gem 'simple_form', '~> 4.0.1'
gem 'haml', '~> 4.0.5'

gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  gem 'chromedriver-helper'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

then run bundle install

Also consider updating the haml gem if you want:

gem 'haml', '~> 5.0.4' instead of gem 'haml', '~> 4.0.5'

then run bundle update

According to the first answer, please tell me where I should modify the Gemfile? Thanks!

source 'https://rubygems.org'
source 'https://rails-assets.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'

# ActiveModel::Serializer implementation and Rails hooks
# gem 'active_model_serializers', require: true

# Use postgres as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'unicorn'

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem 'bugsnag'

# Rack Middleware for handling Cross-Origin Resource Sharing (CORS), which makes cross-origin AJAX possible.
gem 'rack-cors', require: 'rack/cors'

# Authentications & authorizations
gem 'devise', '~> 4.5', github: 'heartcombo/devise', branch: 'main'
gem 'devise-i18n'
gem 'omniauth-facebook'
gem 'omniauth-github'
gem 'omniauth-google-oauth2'
gem 'devise_token_auth', '0.1.43'

# The solution to keep your Rails ActiveRecord migrations up to date
gem 'migration_data'

# Easiest way to add multi-environment yaml settings to Rails, Sinatra, Pandrino and other ruby projects.
gem 'config'

# Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks
gem 'carrierwave'

# Fog is used to support Amazon S3.
# If you cannot install json gem, try `brew install coreutils`
gem 'fog'

# FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models
gem 'friendly_id', '~> 5.2.0'

# A library for creating slugs. Babosa is an extraction and improvement of the string code from FriendlyId, intended to help developers create similar libraries or plugins.
gem 'babosa'

# translate chinese hanzi to pinyin
gem 'chinese_pinyin'

# Ruby library for the Stripe API. https://stripe.com
gem 'stripe'

# Ruby on Rails unobtrusive scripting adapter for jQuery
gem 'jquery-rails'

# Simple, efficient background processing for Ruby.
gem 'sidekiq'
gem 'sidekiq-cron'
gem 'sidekiq-unique-jobs', '5.0.10'

# Intelligent search made easy with Rails and Elasticsearch
gem 'searchkick'
gem 'faraday_middleware-aws-sigv4'


# All sorts of useful information about every country packaged as convenient little country objects. It includes data from ISO 3166 (countries and states/subdivisions ), ISO 4217 (currency), and E.164 (phone numbers).
gem 'countries'

# Rails I18n de-facto standard library for ActiveRecord model/data translation.
gem 'globalize', git: 'https://github.com/globalize/globalize'
gem 'activemodel-serializers-xml'

# A Ruby gem to load environment variables from `.env`.
gem 'dotenv-rails'

# Pagination library for Rails, Sinatra, Merb, DataMapper
# gem 'will_paginate', '~> 3.1.0'

gem 'blog', path: './engines/blog'
# gem 'events', path: './engines/events'
# gem 'healthcare', path: './engines/healthcare'

# Spreeeed custom backend engine
gem 'spreeeed_engine', :git => 'https://github.com/MidnightBlue/spreeeed_engine.git'

# A service for server-side rendering your JavaScript views
gem 'hypernova'

# Brings Rails named routes to javascript http://railsware.github.io/js-routes/
gem 'js-routes'

# Simple HTTP and REST client for Ruby, inspired by microframework syntax for specifying actions.
gem 'rest-client'

# A Ruby Library for dealing with money and currency conversion.
gem 'money'

# A gem that calculates the exchange rate using published rates from European Central Bank. Compatible with the money gem.
gem 'eu_central_bank', github: 'RubyMoney/eu_central_bank', branch: 'main'

# Complete Ruby geocoding solution.
gem 'geocoder'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]

  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'

  # Preview mail in the browser instead of sending.
  gem 'letter_opener'

  #stud_request
  gem 'webmock'

  #BDD test with rspec
  gem 'rspec-rails'

  # RDoc produces HTML and online documentation for Ruby projects. RDoc includes the rdoc and ri tools for generating and displaying online documentation.
  gem 'rdoc'

  # Minitest integration for Rails
  gem 'minitest-rails'

  # A library for setting up Ruby objects as test data.
  gem "factory_bot_rails", "~> 4.0"
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'

  # Pretty print your Ruby objects with style -- in full color and with proper indentation
  gem 'awesome_print', require: true

  # Annotate Rails classes with schema and routes info
  gem 'annotate'

  gem 'mysql2'

end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's many features is the ability to search documents via XPath or CSS3 selectors.
gem 'nokogiri'

#report 500
gem 'sentry-raven'

gem 'rails_autolink'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM