Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create a Rails app due to incompatible library version - load error

First-time post here! I am trying to build a rails app but I am having a ton of difficulty getting started. I have installed Rails, and Ruby but every time I go to make the app (Miless-MBP:railstest miles$ rails new tester2) I get a multitude of errors. The full log is below, but I have listed the 4 here.

Thank you all so much!

/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)

/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `require': incompatible library version - /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)

/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)

/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `require': incompatible library version - /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)
    26: from bin/rails:3:in `<main>'
    25: from bin/rails:3:in `load'
    24: from /Users/miles/railstest/tester2/bin/spring:15:in `<top (required)>'
    23: from /Users/miles/railstest/tester2/bin/spring:15:in `require'
    22: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    21: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    20: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    19: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    18: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    17: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    16: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    15: from /Users/miles/railstest/tester2/bin/rails:8:in `<top (required)>'
    14: from /Users/miles/railstest/tester2/bin/rails:8:in `require_relative'
    13: from /Users/miles/railstest/tester2/config/boot.rb:4:in `<top (required)>'
    12: from /Users/miles/railstest/tester2/config/boot.rb:4:in `require'
    11: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
    10: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
     9: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
     8: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
     7: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     6: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     5: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
     4: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     3: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
     2: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
     1: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `<top (required)>'
/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
    27: from bin/rails:3:in `<main>'
    26: from bin/rails:3:in `load'
    25: from /Users/miles/railstest/tester2/bin/spring:15:in `<top (required)>'
    24: from /Users/miles/railstest/tester2/bin/spring:15:in `require'
    23: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    21: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    20: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    19: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    18: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    17: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/miles/railstest/tester2/bin/rails:8:in `<top (required)>'
    15: from /Users/miles/railstest/tester2/bin/rails:8:in `require_relative'
    14: from /Users/miles/railstest/tester2/config/boot.rb:4:in `<top (required)>'
    13: from /Users/miles/railstest/tester2/config/boot.rb:4:in `require'
    12: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
    11: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
    10: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
     9: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
     8: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     7: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     6: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
     5: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     4: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
     3: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
     2: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:8:in `<top (required)>'
     1: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `require': incompatible library version - /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)
    27: from bin/rails:3:in `<main>'
    26: from bin/rails:3:in `load'
    25: from /Users/miles/railstest/tester2/bin/spring:15:in `<top (required)>'
    24: from /Users/miles/railstest/tester2/bin/spring:15:in `require'
    23: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    21: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    20: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    19: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    18: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    17: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/miles/railstest/tester2/bin/rails:8:in `<top (required)>'
    15: from /Users/miles/railstest/tester2/bin/rails:8:in `require_relative'
    14: from /Users/miles/railstest/tester2/config/boot.rb:4:in `<top (required)>'
    13: from /Users/miles/railstest/tester2/config/boot.rb:4:in `require'
    12: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
    11: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
    10: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
     9: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
     8: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     7: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     6: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
     5: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:39:in `with_gems'
     4: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:43:in `rescue in with_gems'
     3: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
     2: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
     1: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `<top (required)>'
/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
    28: from bin/rails:3:in `<main>'
    27: from bin/rails:3:in `load'
    26: from /Users/miles/railstest/tester2/bin/spring:15:in `<top (required)>'
    25: from /Users/miles/railstest/tester2/bin/spring:15:in `require'
    24: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    23: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    22: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    21: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    20: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    19: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    18: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    17: from /Users/miles/railstest/tester2/bin/rails:8:in `<top (required)>'
    16: from /Users/miles/railstest/tester2/bin/rails:8:in `require_relative'
    15: from /Users/miles/railstest/tester2/config/boot.rb:4:in `<top (required)>'
    14: from /Users/miles/railstest/tester2/config/boot.rb:4:in `require'
    13: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `<top (required)>'
    12: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/setup.rb:1:in `require_relative'
    11: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `<top (required)>'
    10: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap.rb:3:in `require_relative'
     9: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     8: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     7: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
     6: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:39:in `with_gems'
     5: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/explicit_require.rb:43:in `rescue in with_gems'
     4: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
     3: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/store.rb:3:in `require'
     2: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:8:in `<top (required)>'
     1: from /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack.rb:11:in `require': incompatible library version - /Users/miles/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)```

like image 387
Miles Avatar asked Dec 25 '19 15:12

Miles


2 Answers

I had the same issue. You need to completely clean out the msgpack gem using:

gem uninstall msgpack

Then reinstall it, so that the libraries are built against the version of ruby you're now using.

You could also try:

bundle install --redownload

which should reinstall the gems and rebuild the linked libraries with the version of ruby you're now using.

like image 162
rainkinz Avatar answered Oct 20 '22 06:10

rainkinz


FWIW, I just spend several hours on a very similar error, after upgrading a Ruby app from ruby 2.4 to 2.6. I'm using rbenv and bundler on MacOS Mojave.

I can't pinpoint how I fixed it, but after trying lots of updates/rehash/install approaches with little success, I uninstalled about a dozen old versions of ruby and started clean. This got me past the exact error in the question.

This may be overkill, but it worked for me:

List all installed ruby versions:

rbenv versions

Uninstall all versions of Ruby.

rbenv uninstall 2.1
rbenv uninstall 2.1.9
etc.

Install needed version(s) of Ruby

rbenv install

bundle install

I tried running my app after bundle install and got dozens of warnings like these:

Ignoring binding_of_caller-0.8.0 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.8.0
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Ignoring bootsnap-1.4.6 because its extensions are not built.  Try: gem pristine bootsnap --version 1.4.6
Ignoring bootsnap-1.4.5 because its extensions are not built.  Try: gem pristine bootsnap --version 1.4.5

At that time, I could not run bundle exec rake

% bundle exec rake
bundler: command not found: rake
Install missing gem executables with `bundle install`

Running bundle appeared successful, but did not update Gemfile.lock, and did not fix the problem.

Finally, restoring all the gems to pristine solved the problem:

gem pristine --all

Note - gem pristine --all took like a half hour. I'm confused on how these gems got to be in other-than-pristine condition. But...it's working now. I can run the app, rake, etc.

like image 40
David Hempy Avatar answered Oct 20 '22 07:10

David Hempy