LoginSignup
0
0

More than 1 year has passed since last update.

rails開発でincompatible library versionが出た時の対処法

Posted at

結論

・vendor/bundleファイルを削除して、もう一度bundle installを実行すると動くようになる。

開発環境

・rubyバージョンとパス

which ruby
/Users/sanadatadashitsuki/.rbenv/shims/ruby
ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin22]

・gemのパス

which gem
/Users/sanadatadashitsuki/.rbenv/shims/gem

・bundlerのバージョンとパス

which bundle
/Users/sanadatadashitsuki/.rbenv/shims/bundle
bundle -v
Bundler version 2.1.4

発生したエラーコード

bin/rails c
Traceback (most recent call last):
        15: from bin/rails:3:in `<main>'
        14: from bin/rails:3:in `require_relative'
        13: from /Users/sanadatadashitsuki/SimpleBBS/config/boot.rb:4:in `<top (required)>'
        12: from /Users/sanadatadashitsuki/SimpleBBS/config/boot.rb:4:in `require'
        11: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/setup.rb:3:in `<top (required)>'
        10: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/setup.rb:3:in `require_relative'
         9: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap.rb:5:in `<top (required)>'
         8: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap.rb:5:in `require_relative'
         7: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache.rb:68:in `<top (required)>'
         6: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache.rb:68:in `require_relative'
         5: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/store.rb:5:in `<top (required)>'
         4: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/explicit_require.rb:42:in `with_gems'
         3: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/store.rb:5:in `block in <top (required)>'
         2: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/store.rb:5:in `require'
         1: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/msgpack-1.6.0/lib/msgpack.rb:7:in `<top (required)>'
/Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/msgpack-1.6.0/lib/msgpack.rb:7:in `require': incompatible library version - /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/msgpack-1.6.0/lib/msgpack/msgpack.bundle (LoadError)
        16: from bin/rails:3:in `<main>'
        15: from bin/rails:3:in `require_relative'
        14: from /Users/sanadatadashitsuki/SimpleBBS/config/boot.rb:4:in `<top (required)>'
        13: from /Users/sanadatadashitsuki/SimpleBBS/config/boot.rb:4:in `require'
        12: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/setup.rb:3:in `<top (required)>'
        11: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/setup.rb:3:in `require_relative'
        10: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap.rb:5:in `<top (required)>'
         9: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap.rb:5:in `require_relative'
         8: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache.rb:68:in `<top (required)>'
         7: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache.rb:68:in `require_relative'
         6: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/store.rb:5:in `<top (required)>'
         5: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/explicit_require.rb:41:in `with_gems'
         4: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/explicit_require.rb:45:in `rescue in with_gems'
         3: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/store.rb:5:in `block in <top (required)>'
         2: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/store.rb:5:in `require'
         1: from /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/msgpack-1.6.0/lib/msgpack.rb:7:in `<top (required)>'
/Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/msgpack-1.6.0/lib/msgpack.rb:7:in `require': 
incompatible library version - /Users/sanadatadashitsuki/SimpleBBS/vendor/bundle/ruby/2.7.0/gems/msgpack-1.6.0/lib/msgpack/msgpack.bundle (LoadError)

解決策

vendor/bundleファイルを削除

rm -rf vendor/bundle

もう一度bundle install

bundle install --path vendor/bundle
[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag
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 rake 13.0.6
Installing rake 13.0.6
Fetching concurrent-ruby 1.1.10
Installing concurrent-ruby 1.1.10
Fetching i18n 1.12.0
Installing i18n 1.12.0
Fetching minitest 5.16.3
Installing minitest 5.16.3
Fetching tzinfo 2.0.5
Installing tzinfo 2.0.5
Fetching activesupport 7.0.4
Installing activesupport 7.0.4
Fetching builder 3.2.4
Installing builder 3.2.4
Fetching erubi 1.11.0
Installing erubi 1.11.0
Fetching mini_portile2 2.8.0
Installing mini_portile2 2.8.0
Fetching racc 1.6.1
Installing racc 1.6.1 with native extensions
Fetching nokogiri 1.13.10 (x86_64-darwin)
Installing nokogiri 1.13.10 (x86_64-darwin)
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.6
Installing crass 1.0.6
Fetching loofah 2.19.0
Installing loofah 2.19.0
Fetching rails-html-sanitizer 1.4.3
Installing rails-html-sanitizer 1.4.3
Fetching actionview 7.0.4
Installing actionview 7.0.4
Fetching rack 2.2.4
Installing rack 2.2.4
Fetching rack-test 2.0.2
Installing rack-test 2.0.2
Fetching actionpack 7.0.4
Installing actionpack 7.0.4
Fetching nio4r 2.5.8
Installing nio4r 2.5.8 with native extensions
Fetching websocket-extensions 0.1.5
Installing websocket-extensions 0.1.5
Fetching websocket-driver 0.7.5
Installing websocket-driver 0.7.5 with native extensions
Fetching actioncable 7.0.4
Installing actioncable 7.0.4
Fetching globalid 1.0.0
Installing globalid 1.0.0
Fetching activejob 7.0.4
Installing activejob 7.0.4
Fetching activemodel 7.0.4
Installing activemodel 7.0.4
Fetching activerecord 7.0.4
Installing activerecord 7.0.4
Fetching marcel 1.0.2
Installing marcel 1.0.2
Fetching mini_mime 1.1.2
Installing mini_mime 1.1.2
Fetching activestorage 7.0.4
Installing activestorage 7.0.4
Fetching timeout 0.3.1
Installing timeout 0.3.1
Fetching net-protocol 0.2.0
Installing net-protocol 0.2.0
Fetching net-imap 0.3.1
Installing net-imap 0.3.1
Fetching net-pop 0.1.2
Installing net-pop 0.1.2
Fetching net-smtp 0.3.3
Installing net-smtp 0.3.3
Fetching mail 2.8.0
Installing mail 2.8.0
Fetching actionmailbox 7.0.4
Installing actionmailbox 7.0.4
Fetching actionmailer 7.0.4
Installing actionmailer 7.0.4
Fetching actiontext 7.0.4
Installing actiontext 7.0.4
Fetching public_suffix 5.0.1
Installing public_suffix 5.0.1
Fetching addressable 2.8.1
Installing addressable 2.8.1
Fetching bindex 0.8.1
Installing bindex 0.8.1 with native extensions
Fetching msgpack 1.6.0
Installing msgpack 1.6.0 with native extensions
Fetching bootsnap 1.15.0
Installing bootsnap 1.15.0 with native extensions
Using bundler 2.1.4
Fetching matrix 0.4.2
Installing matrix 0.4.2
Fetching regexp_parser 2.6.1
Installing regexp_parser 2.6.1
Fetching xpath 3.2.0
Installing xpath 3.2.0
Fetching capybara 3.38.0
Installing capybara 3.38.0
Fetching io-console 0.5.11
Installing io-console 0.5.11 with native extensions
Fetching reline 0.3.1
Installing reline 0.3.1
Fetching irb 1.5.1
Installing irb 1.5.1
Fetching debug 1.7.0
Installing debug 1.7.0 with native extensions
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching thor 1.2.1
Installing thor 1.2.1
Fetching zeitwerk 2.6.6
Installing zeitwerk 2.6.6
Fetching railties 7.0.4
Installing railties 7.0.4
Fetching importmap-rails 1.1.5
Installing importmap-rails 1.1.5
Fetching jbuilder 2.11.5
Installing jbuilder 2.11.5
Fetching pg 1.4.5
Installing pg 1.4.5 with native extensions
Fetching puma 5.6.5
Installing puma 5.6.5 with native extensions
Fetching rails 7.0.4
Installing rails 7.0.4
Fetching rexml 3.2.5
Installing rexml 3.2.5
Fetching rubyzip 2.3.2
Installing rubyzip 2.3.2
Fetching websocket 1.2.9
Installing websocket 1.2.9
Fetching selenium-webdriver 4.7.1
Installing selenium-webdriver 4.7.1

もう一度bin/rails cを実行

bin/rails c

これで解決しました。

参考サイト

rails -vするとincompatible library versionとエラーが出る

疑問

正直なぜこのエラーが発生していて、ただvendor/bundleファイルを削除してbundle installをもう一度だけ行っただけで動くようになるのかがよくわかっていません。

ただ,今回のエラーが2回ほど別のコマンドを実行して出た際に同じ方法で解決することができました。

また同じエラーが出た時の備忘録として書いておくのですが、詳細な原因についてご存知の方がいらっしゃれば教えていただけると嬉しいです。

よろしくお願いします。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0