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.
第一次在这里发帖!我正在尝试构建一个Rails应用程序,但我在开始时遇到了大量的困难。我已经安装了Rails和Ruby,但每次我去开发这个应用程序(Miless-MBP:Railstest Miles$rails new tester2)时,我都会收到大量错误。完整的日志在下面,但我在这里列出了4个。
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)```
更多回答
Hey, Have you able to installed msgpack in your local machine successfully?
嘿,你能在你的本地机器上成功安装msgpack吗?
Hi @Asmita I have not. Do you know you how I would do so?
嗨,@阿斯米塔,我没有。你知道我会怎么做吗?
@TalaatMagdy would you possibly be able to elaborate? Thanks for the help so far though!
@TalaatMagdy你能详细说明一下吗?不过,还是要感谢你到目前为止的帮助!
Okay -- so now I have installed msgpack. The only error I get now is: /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': incompatible library version - /Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/bootsnap.bundle (LoadError)
好的--现在我已经安装了msgpack。我现在得到的唯一错误是:/Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in‘Required’:不兼容的库版本-/Users/miles/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/bootsnap.bundle(LoadError)
I had the same issue. You need to completely clean out the msgpack
gem using:
我也有同样的问题。您需要使用以下命令完全清除msgpack gem:
gem uninstall msgpack
Then reinstall it, so that the libraries are built against the version of ruby you're now using.
然后重新安装它,这样库就可以根据你现在使用的ruby版本构建。
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.
这应该会重新安装gem并使用您现在使用的ruby版本重新构建链接库。
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.
顺便说一句,在将Ruby应用程序从Ruby 2.4升级到2.6之后,我刚刚花了几个小时处理了一个非常类似的错误。我在MacOS Mojave上使用rbenv和bundler。
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.
我不清楚我是如何修复它的,但在尝试了许多更新/重新散列/安装方法都收效甚微之后,我卸载了大约12个旧版本的Ruby,并从头开始。这让我越过了问题中的确切错误。
This may be overkill, but it worked for me:
这可能有些夸大其词,但它对我很管用:
List all installed ruby versions:
列出所有已安装的Ruby版本:
rbenv versions
Uninstall all versions of Ruby.
卸载所有版本的Ruby。
rbenv uninstall 2.1
rbenv uninstall 2.1.9
etc.
Install needed version(s) of Ruby
安装所需版本的Ruby(S)
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
当时,我不能运行捆绑包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.
运行捆绑包似乎成功,但没有更新Gemfile.lock,也没有解决问题。
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.
注意--原汁原味的宝石--所有这些都花了大约半个小时。我搞不懂这些宝石怎么会处于非原始状态。但是...它现在起作用了。我可以运行应用程序、RAKE等。
更多回答
bundle install --redownload
works for me. Mine got into a bad state because I was using rvm and I installed the wrong version and tried to install a new version of ruby, but they are on the same minor version. For example, I first installed 2.7.2 and then tried to upgrade to 2.7.5.
包安装--重新下载适用于我。我的系统进入了糟糕的状态,因为我使用的是RVM,我安装了错误的版本,并试图安装新版本的Ruby,但它们都在同一个次要版本上。例如,我首先安装了2.7.2,然后尝试升级到2.7.5。
worked like charm !
就像魅力一样奏效!
Thanks!! bundle install --redownload
worked for me
谢谢!!捆绑包安装--重新下载对我有效
gem pristine --all
was the fix for me
宝石原汁原味--对我来说,一切都是正确的
我是一名优秀的程序员,十分优秀!