在 M1 芯片上运行 rails 时出错(Apple Silicon)

Posted

技术标签:

【中文标题】在 M1 芯片上运行 rails 时出错(Apple Silicon)【英文标题】:Error running rails s on M1 chip (Apple Silicon) 【发布时间】:2021-05-11 23:39:06 【问题描述】:

我正在尝试学习 Rails,但在尝试运行服务器时遇到了问题。我阅读了 reddit、Youtube 教程、Stackover 流程​​帖子和博客的帖子,得出的结论是,当您将 M1 芯片用于开发目的(不包括前端)时,确实存在已知问题。

根据我在下面所述的论坛主题链接,msgpack 与 Apple 架构不兼容。我真的不知道如何构建它以使其与 M1 芯片兼容。

PS:我是 Rails 的新手,如果我的帖子有任何问题,我提前道歉。我愿意更正。

预期输出:

在 M1 芯片上运行 rails s(如果可能,不使用 Rosetta)

到目前为止我做了什么:

    尝试捆绑安装(捆绑安装后的输出见下文) 捆绑安装后退出终端 阅读此论坛主题 https://superuser.com/questions/1618896/how-to-run-ruby-on-rails-on-new-macbook-air-m1/1619366

我的设置:

ruby 2.7.2p137(2020-10-01 修订版 5445e04352)[arm64-darwin20](系统 ruby​​)

Rails 6.1.1

纱线 1.22.10

节点 v14.15.4

版本管理器:ASDF

IDE:崇高文本

捆绑安装输出:

Using rake 13.0.3
Using concurrent-ruby 1.1.8
Using i18n 1.8.8
Using minitest 5.14.3
Using tzinfo 2.0.4
Using zeitwerk 2.4.2
Using activesupport 6.1.1
Using builder 3.2.4
Using erubi 1.10.0
Using racc 1.5.2
Using nokogiri 1.11.1 (arm64-darwin)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.9.0
Using rails-html-sanitizer 1.3.0
Using actionview 6.1.1
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.1.1
Using nio4r 2.5.4
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.3
Using actioncable 6.1.1
Using globalid 0.4.2
Using activejob 6.1.1
Using activemodel 6.1.1
Using activerecord 6.1.1
Using mimemagic 0.3.5
Using marcel 0.3.3
Using activestorage 6.1.1
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.1.1
Using actionmailer 6.1.1
Using actiontext 6.1.1
Using public_suffix 4.0.6
Using addressable 2.7.0
Using bindex 0.8.1
Using msgpack 1.4.2
Using bootsnap 1.7.0
Using bundler 2.2.7
Using byebug 11.1.3
Using regexp_parser 2.0.3
Using xpath 3.2.0
Using capybara 3.35.3
Using childprocess 3.0.0
Using ffi 1.14.2
Using jbuilder 2.11.2
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using listen 3.4.1
Using method_source 1.0.0
Using puma 5.2.0
Using rack-mini-profiler 2.3.1
Using rack-proxy 0.6.5
Using thor 1.1.0
Using railties 6.1.1
Using sprockets 4.0.2
Using sprockets-rails 3.2.2
Using rails 6.1.1
Using rubyzip 2.3.0
Using sassc 2.4.0
Using tilt 2.0.10
Using sassc-rails 2.1.2
Using sass-rails 6.0.0
Using selenium-webdriver 3.142.7
Using semantic_range 2.3.1
Using spring 2.1.1
Using sqlite3 1.4.2
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using web-console 4.1.0
Using webdrivers 4.5.0
Using webpacker 5.2.1
Bundle complete! 17 Gemfile dependencies, 74 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

轨道 s 的输出:

Traceback (most recent call last):
    29: from bin/rails:2:in `<main>'
    28: from bin/rails:2:in `load'
    27: from /Users/leatinoso/facebook/bin/spring:7:in `<top (required)>'
    26: from /Users/leatinoso/facebook/bin/spring:7:in `tap'
    25: from /Users/leatinoso/facebook/bin/spring:10:in `block in <top (required)>'
    24: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    23: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    22: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    21: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    20: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    19: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    18: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    17: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    16: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    15: from /Users/leatinoso/facebook/bin/rails:4:in `<top (required)>'
    14: from /Users/leatinoso/facebook/bin/rails:4:in `require_relative'
    13: from /Users/leatinoso/facebook/config/boot.rb:4:in `<top (required)>'
    12: from /Users/leatinoso/facebook/config/boot.rb:4:in `require'
    11: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/setup.rb:2:in `<top (required)>'
    10: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/setup.rb:2:in `require_relative'
     9: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap.rb:5:in `<top (required)>'
     8: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap.rb:5:in `require_relative'
     7: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache.rb:61:in `<top (required)>'
     6: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache.rb:61:in `require_relative'
     5: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     4: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/explicit_require.rb:41:in `with_gems'
     3: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     2: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     1: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `<top (required)>'
/Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `require': dlopen(/Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle, 9): no suitable image found.  Did find: (LoadError)
    /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle: mach-o, but wrong architecture
    /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle: mach-o, but wrong architecture - /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle
    30: from bin/rails:2:in `<main>'
    29: from bin/rails:2:in `load'
    28: from /Users/leatinoso/facebook/bin/spring:7:in `<top (required)>'
    27: from /Users/leatinoso/facebook/bin/spring:7:in `tap'
    26: from /Users/leatinoso/facebook/bin/spring:10:in `block in <top (required)>'
    25: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    24: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
    23: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    22: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    21: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    20: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    19: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    18: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    17: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    16: from /Users/leatinoso/facebook/bin/rails:4:in `<top (required)>'
    15: from /Users/leatinoso/facebook/bin/rails:4:in `require_relative'
    14: from /Users/leatinoso/facebook/config/boot.rb:4:in `<top (required)>'
    13: from /Users/leatinoso/facebook/config/boot.rb:4:in `require'
    12: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/setup.rb:2:in `<top (required)>'
    11: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/setup.rb:2:in `require_relative'
    10: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap.rb:5:in `<top (required)>'
     9: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap.rb:5:in `require_relative'
     8: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache.rb:61:in `<top (required)>'
     7: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache.rb:61:in `require_relative'
     6: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache/store.rb:4:in `<top (required)>'
     5: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/explicit_require.rb:40:in `with_gems'
     4: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/explicit_require.rb:44:in `rescue in with_gems'
     3: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'
     2: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.0/lib/bootsnap/load_path_cache/store.rb:4:in `require'
     1: from /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `<top (required)>'
/Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `require': dlopen(/Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle, 9): no suitable image found.  Did find: (LoadError)
    /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle: mach-o, but wrong architecture
    /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle: mach-o, but wrong architecture - /Users/leatinoso/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle

Gemfile.lock 文件:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.1.1)
      actionpack (= 6.1.1)
      activesupport (= 6.1.1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.1.1)
      actionpack (= 6.1.1)
      activejob (= 6.1.1)
      activerecord (= 6.1.1)
      activestorage (= 6.1.1)
      activesupport (= 6.1.1)
      mail (>= 2.7.1)
    actionmailer (6.1.1)
      actionpack (= 6.1.1)
      actionview (= 6.1.1)
      activejob (= 6.1.1)
      activesupport (= 6.1.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.1.1)
      actionview (= 6.1.1)
      activesupport (= 6.1.1)
      rack (~> 2.0, >= 2.0.9)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.1.1)
      actionpack (= 6.1.1)
      activerecord (= 6.1.1)
      activestorage (= 6.1.1)
      activesupport (= 6.1.1)
      nokogiri (>= 1.8.5)
    actionview (6.1.1)
      activesupport (= 6.1.1)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (6.1.1)
      activesupport (= 6.1.1)
      globalid (>= 0.3.6)
    activemodel (6.1.1)
      activesupport (= 6.1.1)
    activerecord (6.1.1)
      activemodel (= 6.1.1)
      activesupport (= 6.1.1)
    activestorage (6.1.1)
      actionpack (= 6.1.1)
      activejob (= 6.1.1)
      activerecord (= 6.1.1)
      activesupport (= 6.1.1)
      marcel (~> 0.3.1)
      mimemagic (~> 0.3.2)
    activesupport (6.1.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
      zeitwerk (~> 2.3)
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    bindex (0.8.1)
    bootsnap (1.7.0)
      msgpack (~> 1.0)
    builder (3.2.4)
    byebug (11.1.3)
    capybara (3.35.3)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (>= 1.5, < 3.0)
      xpath (~> 3.2)
    childprocess (3.0.0)
    concurrent-ruby (1.1.8)
    crass (1.0.6)
    erubi (1.10.0)
    ffi (1.14.2)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    i18n (1.8.8)
      concurrent-ruby (~> 1.0)
    jbuilder (2.11.2)
      activesupport (>= 5.0.0)
    listen (3.4.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    loofah (2.9.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (1.0.0)
    mimemagic (0.3.5)
    mini_mime (1.0.2)
    minitest (5.14.3)
    msgpack (1.4.2)
    nio4r (2.5.4)
    nokogiri (1.11.1-arm64-darwin)
      racc (~> 1.4)
    public_suffix (4.0.6)
    puma (5.2.0)
      nio4r (~> 2.0)
    racc (1.5.2)
    rack (2.2.3)
    rack-mini-profiler (2.3.1)
      rack (>= 1.2.0)
    rack-proxy (0.6.5)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.1.1)
      actioncable (= 6.1.1)
      actionmailbox (= 6.1.1)
      actionmailer (= 6.1.1)
      actionpack (= 6.1.1)
      actiontext (= 6.1.1)
      actionview (= 6.1.1)
      activejob (= 6.1.1)
      activemodel (= 6.1.1)
      activerecord (= 6.1.1)
      activestorage (= 6.1.1)
      activesupport (= 6.1.1)
      bundler (>= 1.15.0)
      railties (= 6.1.1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (6.1.1)
      actionpack (= 6.1.1)
      activesupport (= 6.1.1)
      method_source
      rake (>= 0.8.7)
      thor (~> 1.0)
    rake (13.0.3)
    rb-fsevent (0.10.4)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    regexp_parser (2.0.3)
    rubyzip (2.3.0)
    sass-rails (6.0.0)
      sassc-rails (~> 2.1, >= 2.1.1)
    sassc (2.4.0)
      ffi (~> 1.9)
    sassc-rails (2.1.2)
      railties (>= 4.0.0)
      sassc (>= 2.0)
      sprockets (> 3.0)
      sprockets-rails
      tilt
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    semantic_range (2.3.1)
    spring (2.1.1)
    sprockets (4.0.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.2)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.4.2)
    thor (1.1.0)
    tilt (2.0.10)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (2.0.4)
      concurrent-ruby (~> 1.0)
    web-console (4.1.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webdrivers (4.5.0)
      nokogiri (~> 1.6)
      rubyzip (>= 1.3.0)
      selenium-webdriver (>= 3.0, < 4.0)
    webpacker (5.2.1)
      activesupport (>= 5.2)
      rack-proxy (>= 0.6.1)
      railties (>= 5.2)
      semantic_range (>= 2.3.0)
    websocket-driver (0.7.3)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.4.2)

PLATFORMS
  arm64-darwin-20

DEPENDENCIES
  bootsnap (>= 1.4.4)
  byebug
  capybara (>= 3.26)
  jbuilder (~> 2.7)
  listen (~> 3.3)
  puma (~> 5.0)
  rack-mini-profiler (~> 2.0)
  rails (~> 6.1.1)
  sass-rails (>= 6)
  selenium-webdriver
  spring
  sqlite3 (~> 1.4)
  turbolinks (~> 5)
  tzinfo-data
  web-console (>= 4.1.0)
  webdrivers
  webpacker (~> 5.0)

RUBY VERSION
   ruby 2.7.2p137

BUNDLED WITH
   2.2.7

宝石文件:

source 'https://rubygems.org'
git_source(:github)  |repo| "https://github.com/#repo.git" 

ruby '2.7.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like javascript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 4.1.0'
  # Display performance information such as SQL time and flame graphs for each request in your browser.
  # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
  gem 'rack-mini-profiler', '~> 2.0'
  gem 'listen', '~> 3.3'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 3.26'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

更新 安装 msgpack gem 就成功了。不过,感谢您的所有投入。我只是通过终端运行命令“gem i msgpack”。

【问题讨论】:

也许这有帮助:github.com/msgpack/msgpack-ruby/issues/195 【参考方案1】:

在您的终端中

$ gem install msgpack

【讨论】:

这行得通!谢谢!【参考方案2】:

我也是一名 MBA M1 rails 开发人员。在遇到特定 gem(nokogiriffi 等)的一些问题后,我决定卸载所有内容并从头开始在我的应用程序中创建 terminal - rosetta 快​​捷方式。我重新安装了从 homebrewasdfrails 的所有内容,从那以后一直在愉快地开发。

可以在here 找到一个非常好的指南。如果您想尝试一下,我相信我一直坚持到 UPDATE 点,他会选择本地版本。请注意,如果您通过 terminal-rosetta 遵循该指南,则无需创建 别名 aibrew 或在指定位置运行它们。

我不得不说,在这个设置中工作了一个多月,它一直坚如磐石,我偶尔唯一需要做的就是更新一些在旧项目中造成问题的特定 gem。

如果您选择 Rosetta 或 Native 版本,请告诉我效果如何。

【讨论】:

以上是关于在 M1 芯片上运行 rails 时出错(Apple Silicon)的主要内容,如果未能解决你的问题,请参考以下文章

在 M1 Mac 上运行 Flutter Doctor 时出错 - 无法找到捆绑的 Java 版本

迁移到 M1 Mac 后在 iOS 上运行 Flutter App 时出错

无法在苹果 m1 芯片中的颤振项目上执行 pod 安装

如何使用 M1 芯片在我的 Mac 上运行 pyqt5

尝试使用我的 m1 mac 运行我的 Flutter 应用程序时出错

iOS逆向----Mac m1芯片检测