質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1293閲覧

rails sを実行する際のエラーに関して。

ShoheiSmith

総合スコア2

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/01/02 16:12

プログラム始学者のため、必要な情報が記載できていない可能性があり、ご迷惑をおかけします。

rails の開発環境を構築しているのですが、rails sでローカルサーバーを他立ち上げる際にエラーが出てしまっています。
色々と検索して、必要なファイル諸々インストール完了しているのですが、それでもうまく行きません。

ところどとこに 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)と出てくるのですが、これの意味が分からず大変困っております。

ruby 3.0.0
Rails 6.1.0
Homebrew 2.7.1
rbenv 1.1.2を使っています。

エラー解消方法お分かりの方いらっしゃったらぜひ助けていただきたいです。

下記rails sを実行した際に出てくるメッセージを貼り付けています。
よろしくお願いします。

Traceback (most recent call last):
29: from bin/rails:2:in <main>' 28: from bin/rails:2:in load'
27: from /Users/shouheismith/camplog/bin/spring:5:in <top (required)>' 26: from /Users/shouheismith/camplog/bin/spring:5:in tap'
25: from /Users/shouheismith/camplog/bin/spring:8: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/shouheismith/camplog/bin/rails:4:in <top (required)>' 14: from /Users/shouheismith/camplog/bin/rails:4:in require_relative'
13: from /Users/shouheismith/camplog/config/boot.rb:4:in <top (required)>' 12: from /Users/shouheismith/camplog/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)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

/Library/Ruby/Gems/2.6.0/gems/msgpack-1.3.3/lib/msgpack.rb:9:in
2: from /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.5.1

rbenvで自分のホームディレクトリにrubyをインストールしているはずのに、
/Libraryのrubyの方が有効になっているように見えます。

エラーメッセージだけでは何もわかりませんので、ruby環境の設定を見直してみましょう。

自分のMacもあなたとほぼ同じ環境ですがrailsは問題なく起動します。
$ ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
$ rails -v
Rails 6.1.0
$ rbenv -v
rbenv 1.1.2
$ brew -v
Homebrew 2.7.0-100-gda0d7ef

投稿2021/01/03 00:54

technocore

総合スコア7200

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

ShoheiSmith

2021/01/03 05:17

回答ありがとうございます。 使用可能なRuby一覧を表示させたところ、下記のディレクトリにインストールできているみたいなのですが、/.rbenvの.が余計なのでしょうか? 初歩的な質問で申し訳ありません。 $rbenv versions system * 3.0.0 (set by /Users/shouheismith/.rbenv/version)
technocore

2021/01/03 05:24

typeコマンドで、rubyコマンドとgemコマンドの場所を確認してください。 rbenvでインストールしたruby(とgem)を指しているでしょうか? $ type ruby gem ruby is /Users/shouheismith/.rbenv/shims/ruby gem is /Users/shouheismith/.rbenv/shims/gem rubyのバージョンも確認しましょう $ ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
ShoheiSmith

2021/01/03 07:37

返信が遅くなてしまい申し訳ありません。 下記ご教授ただいた内容で、コマンドの場所を確認したのですが、きちんと同じところに保存されているようです。。。 shouheismith@shouheinoMacBook-Air ~ % type ruby gem ruby is /Users/shouheismith/.rbenv/shims/ruby gem is /Users/shouheismith/.rbenv/shims/gem shouheismith@shouheinoMacBook-Air ~ % ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
technocore

2021/01/03 07:53

yarnと、Xcodeのコマンドラインツールズはインストールされていますでしょうか?
ShoheiSmith

2021/01/03 08:25

yarnは問題なくインストールできているようなのですが、 shouheismith@shouheinoMacBook-Air ~ % type yarn yarn is /opt/homebrew/bin/yarn Xcodeの方で、コマンドラインツールズのインストールはできていると表示されるのですが、version情報を取得しようとすると、下記のようなエラーが表示されてしまいます。 XcodeはFinderからversion12.3が入っているのを確認できました。 shouheismith@shouheinoMacBook-Air ~ % xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates shouheismith@shouheinoMacBook-Air ~ % xcodebuild -version xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
ShoheiSmith

2021/01/03 17:34

ruby2.6.3にバージョンダウンしてwebpackを入れ直したら開くことができました! もろもろお助けいただきありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問