Rails 5.にアップグレードしようとしています。Gemfile.lockファイルを削除し、Gemfileを次のように編集しました。
source 'https://rubygems.org'
# Bundle Edge Rails instead: gem 'Rails', github: 'Rails/rails'
gem 'Rails', '5.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-Rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-Rails', '~> 4.1.0'
# See https://github.com/Rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :Ruby
# Use jquery as the JavaScript library
gem 'jquery-Rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/Rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/Rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:Rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'Unicorn'
# Use Capistrano for deployment
# gem 'capistrano-Rails', group: :development
gem 'addressable'
gem 'postgresql'
gem 'pundit'
gem 'omniauth-oauth2', '~> 1.3.1'
gem 'omniauth-google-oauth2'
gem 'omniauth-facebook'
gem 'omniauth-Twitter'
gem 'omniauth-linkedin-oauth2'
gem 'jquery-Rails'
gem 'jquery-ui-Rails'
gem 'jquery-modal-Rails'
gem 'will_paginate'
gem 'bootstrap-sass'
gem 'autoprefixer-Rails'
gem 'whenever', :require => false
gem 'compass-Rails'
group :development do
gem 'Rails_layout'
end
「バンドルインストール」を実行しましたが、以下のエラーが発生しました
$ bundle install
Your Gemfile lists the gem jquery-Rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies..............
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-Rails (~> 4.1.0) was resolved to 4.1.1, which depends on
railties (< 5.1.x, >= 4.0.0)
jquery-modal-Rails was resolved to 0.0.1, which depends on
railties (< 5.0, >= 3.2.0)
jquery-Rails was resolved to 4.1.1, which depends on
railties (>= 4.2.0)
Rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
sass-Rails (~> 5.0) was resolved to 5.0.6, which depends on
railties (< 6, >= 4.0.0)
web-console (~> 2.0) was resolved to 2.3.0, which depends on
railties (>= 4.0)
Rails 5にアップグレードできるように、Gemfileを適切に編集するにはどうすればよいですか?
繰り返されるjquery-Railsgemの1つを削除して、bundleinstallを再度実行してみてください。
// remove this line
gem 'jquery-Rails'
また、これのためにあなたの宝石の「コーヒー-レール」ラインを変更してください:
gem 'coffee-Rails', '~> 4.2'
次のGemfileで問題なく実行されているRails 5プロジェクトがあります:
source 'https://rubygems.org'
# Bundle Edge Rails instead: gem 'Rails', github: 'Rails/rails'
gem 'Rails', '~> 5.0.0'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-Rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-Rails', '~> 4.2'
# See https://github.com/Rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :Ruby
# Use jquery as the JavaScript library
gem 'jquery-Rails'
# 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 Capistrano for deployment
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# 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'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Railtiesの宝石を再インストールしてみてください:
gem install railties