如何在新款 MacBook Air M1 上运行 Ruby on Rails?

如何在新款 MacBook Air M1 上运行 Ruby on Rails?

我正在运行 Ruby 版本 2.7.2,并且一直尝试运行 Ruby on Rails,但似乎没有任何效果。我尝试过rvmrbenv现在也尝试过asdf,但每次我成功运行后尝试rails server在旧项目中运行时bundle install,都会出现这个长错误:

    Traceback (most recent call last):
    29: from bin/rails:2:in `<main>'
    28: from bin/rails:2:in `load'
    27: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `<top (required)>'
    26: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `tap'
    25: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:10:in `block in <top (required)>'
    24: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    23: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    17: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    16: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    15: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `<top (required)>'
    14: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `require_relative'
    13: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `<top (required)>'
    12: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `require'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:41:in `with_gems'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     2: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
    30: from bin/rails:2:in `<main>'
    29: from bin/rails:2:in `load'
    28: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `<top (required)>'
    27: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `tap'
    26: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:10:in `block in <top (required)>'
    25: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    24: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    23: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    17: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `<top (required)>'
    15: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `require_relative'
    14: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `<top (required)>'
    13: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `require'
    12: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:41:in `with_gems'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:8:in `<top (required)>'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle - /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle (LoadError)
    30: from bin/rails:2:in `<main>'
    29: from bin/rails:2:in `load'
    28: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `<top (required)>'
    27: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `tap'
    26: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:10:in `block in <top (required)>'
    25: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    24: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    23: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    17: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `<top (required)>'
    15: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `require_relative'
    14: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `<top (required)>'
    13: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `require'
    12: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:44:in `rescue in with_gems'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     2: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
    31: from bin/rails:2:in `<main>'
    30: from bin/rails:2:in `load'
    29: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `<top (required)>'
    28: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:7:in `tap'
    27: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/spring:10:in `block in <top (required)>'
    26: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    25: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    24: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    23: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    17: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `<top (required)>'
    16: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/bin/rails:4:in `require_relative'
    15: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `<top (required)>'
    14: from /Users/arpanabhishek/projects/coronafree-projects/todo_manager/config/boot.rb:4:in `require'
    13: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    12: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:44:in `rescue in with_gems'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:8:in `<top (required)>'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle - /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle (LoadError)

如果我尝试创建新的 Rails 应用程序,我会收到此错误

    Traceback (most recent call last):
    29: from bin/rails:2:in `<main>'
    28: from bin/rails:2:in `load'
    27: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `<top (required)>'
    26: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `tap'
    25: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:10:in `block in <top (required)>'
    24: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    23: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    17: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    16: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    15: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `<top (required)>'
    14: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `require_relative'
    13: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `<top (required)>'
    12: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `require'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:41:in `with_gems'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     2: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
    30: from bin/rails:2:in `<main>'
    29: from bin/rails:2:in `load'
    28: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `<top (required)>'
    27: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `tap'
    26: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:10:in `block in <top (required)>'
    25: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    24: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    23: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    17: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `<top (required)>'
    15: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `require_relative'
    14: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `<top (required)>'
    13: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `require'
    12: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:41:in `with_gems'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:8:in `<top (required)>'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `require': dlsym(0x7fe15f3a38d0, Init_msgpack): symbol not found - /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle (LoadError)
    30: from bin/rails:2:in `<main>'
    29: from bin/rails:2:in `load'
    28: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `<top (required)>'
    27: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `tap'
    26: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:10:in `block in <top (required)>'
    25: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    24: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    23: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    17: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `<top (required)>'
    15: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `require_relative'
    14: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `<top (required)>'
    13: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `require'
    12: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:44:in `rescue in with_gems'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     2: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in `require': cannot load such file -- msgpack/2.6/msgpack (LoadError)
    31: from bin/rails:2:in `<main>'
    30: from bin/rails:2:in `load'
    29: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `<top (required)>'
    28: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:7:in `tap'
    27: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/spring:10:in `block in <top (required)>'
    26: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    25: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    24: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    23: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    22: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    21: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    20: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    19: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    18: from /Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    17: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `<top (required)>'
    16: from /Users/arpanabhishek/projects/coronafree-projects/myApp/bin/rails:4:in `require_relative'
    15: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `<top (required)>'
    14: from /Users/arpanabhishek/projects/coronafree-projects/myApp/config/boot.rb:4:in `require'
    13: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `<top (required)>'
    12: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/setup.rb:2:in `require_relative'
    11: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `<top (required)>'
    10: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap.rb:5:in `require_relative'
     9: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `<top (required)>'
     8: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache.rb:74:in `require_relative'
     7: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     6: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     5: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/explicit_require.rb:44:in `rescue in with_gems'
     4: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     3: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:8:in `<top (required)>'
     1: from /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:11:in `require': dlsym(0x7fe15f2d35c0, Init_msgpack): symbol not found - /Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack/msgpack.bundle (LoadError)

答案1

我的新 M1 上刚刚被这个问题困扰了一整天。

解决方式:

  1. 在应用程序/实用程序下的 Finder 中找到终端。cmd+c然后cmd+ v“终端”并将其重命名为“TerminalRosetta”

  2. 右击,然后点击“获取信息”。然后选中“使用 Rosetta 打开”复选框。然后点击红色 x 并关闭该对话框。

  3. 从现在开始打开并使用“TerminalRosetta”

  4. 粘贴: export PATH="$HOME/.rbenv/bin:$PATH" 进入你的终端并按回车键

  5. 粘贴: eval "$(rbenv init -)" 进入你的终端并按回车键

  6. 照常安装 ruby​​ 和 rails。

如果您有任何其他问题——我使用本教程: https://www.youtube.com/watch?v=jT_SPPPhRBk

答案2

我遇到了同样的问题,发现你可以通过以下方式实现本机(非 Rosetta)解决方案

  1. 安装自制
  2. brew install ruby(目前为 3.0.1)- 这使得 rbenv 能够成功构建 Apple 系统 ruby​​ 导致失败的其他版本
  3. brew install rbenv,然后设置你的 shell
  4. homebrew 的 ruby​​ 仅适用于 keg,因此你需要export PKG_CONFIG_PATH="/opt/homebrew/opt/ruby/lib/pkgconfig"先:
  5. rbenv install 2.7.3- 我在较低版本上没有成功
  6. bundle install
  7. 如果使用较旧的版本,Gemfile.lock你可能需要修改 gem 版本 - 我必须更新一些版本才能使我的应用程序正常运行

相关内容