参考
現状
Gemfile
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.4', '>= 5.2.4.3'
最新調査
リストの中確認,2.7.1が最新?
-> % 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
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
最新版2.7.1だったわ
1個上の手順意味なかったかも
https://www.ruby-lang.org/ja/downloads/
うん、2.7.1はいってるやん。だから、N(->No)。
-> % rbenv install 2.7.1
rbenv: /Users/(username)/.rbenv/versions/2.7.1 already exists
continue with installation? (y/N) N
でも、プロジェクトは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`
これでたから、下記のどちらか打った。
bundle update --bundler
gem install bundler:1.17.2
なんか色々やってるうちにこれが邪魔しだした。
-> % 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
いろいろ、調べて参照してるバージョンが違うからみたいな記事が多かったけど、私の場合は、
Gemfileを
ruby '2.7.1'
に書き換えたらいいだけだったぽい。bundle install
は通るようになった。
次はRailsのバージョンアップ
これもGemfileを
gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
にして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.
怒られた。
bundle update
して
bundle install
したら行けた。