https://qiita.com/kanacan/items/c1499f6c13b1c41da982
Gemfile
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.4', '>= 5.2.4.3'
Check in the list, 2.7.1 is the latest?
-> % rbenv install --list
2.5.8
2.6.6
2.7.1
jruby-9.2.12.0
maglev-1.0.0
mruby-2.1.1
rbx-5.0
truffleruby-20.1.0
truffleruby+graalvm-20.1.0
Update rbenv?
-> % brew upgrade rbenv ruby-build
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 4 taps (heroku/brew, homebrew/core, homebrew/cask and homebrew/services).
==> New Formulae
It was the latest version 2.7.1 The procedure one step up might not have meant https://www.ruby-lang.org/ja/downloads/ Yeah, 2.7.1 is on. So N (-> No).
-> % rbenv install 2.7.1
rbenv: /Users/(username)/.rbenv/versions/2.7.1 already exists
continue with installation? (y/N) N
But the project is 2.6.3. .. ..
-> % rbenv versions
system
2.3.7
2.3.8
2.5.1
2.5.3
* 2.6.3 (set by /Users/(username)/projects/import_agent_app/.ruby-version)
2.6.5
2.6.6
2.7.1
-> % git checkout -b feature/version_up
Switched to a new branch 'feature/version_up'
-> % rbenv local 2.7.1
[feature/version_up *]
-> % rbenv versions
system
2.3.7
2.3.8
2.5.1
2.5.3
2.6.3
2.6.5
2.6.6
* 2.7.1 (set by /Users/(username)/projects/import_agent_app/.ruby-version)
-> % bundle install
Traceback (most recent call last):
2: from /Users/(username)/.rbenv/versions/2.7.1/bin/bundle:23:in `<main>'
1: from /Users/(username)/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
/Users/(username)/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.17.2) required by your /Users/(username)/projects/import_agent_app/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.2`
With this, I hit either of the following.
bundle update --bundler
gem install bundler:1.17.2
This got in the way while I was doing various things.
-> % bundle install
/Users/(username)/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
Your Ruby version is 2.7.1, but your Gemfile specified 2.6.3
There were many articles that seemed to be because the version I was researching and referring to was different, but in my case, Gemfile
ruby '2.7.1'
I just had to rewrite it to. bundle install
now works.
Next is Rails version upgrade This is also a Gemfile
gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
Then you can go if you do budle install
.
-> % bundle install
/Users/(username)/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (= 5.2.4.3)
In Gemfile:
rails (~> 6.0.3, >= 6.0.3.3) was resolved to 6.0.3.3, which depends on
activesupport (= 6.0.3.3)
web-console (>= 3.3.0) was resolved to 3.7.0, which depends on
railties (>= 5.0) was resolved to 5.2.4.3, which depends on
activesupport (= 5.2.4.3)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I got scolded.
bundle update
do it
bundle install
Then I was able to go.
Recommended Posts