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

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

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

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

Q&A

1回答

190閲覧

railsで作成したアプリをAWSにアップロードしたいがエラーが出てしまっている。

kei0316

総合スコア0

Ruby on Rails

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

0グッド

0クリップ

投稿2025/04/30 12:17

実現したいこと

環境系エラーを解決して自動デプロイできるようにしたい。

発生している問題・分からないこと

It looks like you're trying to use Nokogiri as a precompiled native gem on a system with an unsupported version of glibc. と表示されている。

エラーメッセージ

error

100:11 deploy:assets:precompile 2 01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile 3 01 4 01 ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system 5 01 with an unsupported version of glibc. 6 01 7 01 /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/www/furima-41578/shared/bundle/ruby/3.2.0… 8 01 9 01 If that's the case, then please install Nokogiri via the `ruby` platform gem: 10 01 gem install nokogiri --platform=ruby 11 01 or: 12 01 bundle config set force_ruby_platform true 13 01 14 01 Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help. 15 01 16 01 17 01 ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system 18 01 with an unsupported version of glibc. 19 01 20 01 /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/www/furima-41578/shared/bundle/ruby/3.2.0… 21 01 22 01 If that's the case, then please install Nokogiri via the `ruby` platform gem: 23 01 gem install nokogiri --platform=ruby 24 01 or: 25 01 bundle config set force_ruby_platform true 26 01 27 01 Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help. 28 01 29 01 rake aborted! 30 01 LoadError: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/www/furima-41578/shared/bundle/r… 31 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/nokogiri-1.18.8-x86_64-linux-gnu/lib/nokogiri/extension.rb… 32 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/nokogiri-1.18.8-x86_64-linux-gnu/lib/nokogiri/extension.rb… 33 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/nokogiri-1.18.8-x86_64-linux-gnu/lib/nokogiri.rb:8:in `req… 34 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/nokogiri-1.18.8-x86_64-linux-gnu/lib/nokogiri.rb:8:in `<ma… 35 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 36 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 37 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 38 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/loofah-2.24.0/lib/loofah.rb:3:in `<main>' 39 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 40 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 41 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 42 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/rails-html-sanitizer-1.6.2/lib/rails-html-sanitizer.rb:5:i… 43 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 44 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 45 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 46 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/actionview-8.0.2/lib/action_view/helpers/sanitize_helper.r… 47 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 48 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 49 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 50 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/actionview-8.0.2/lib/action_view/helpers.rb:8:in `<main>' 51 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 52 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 53 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 54 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/sprockets-rails-3.5.2/lib/sprockets/rails/context.rb:1:in … 55 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 56 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 57 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 58 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/sprockets-rails-3.5.2/lib/sprockets/railtie.rb:11:in `<mai… 59 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 60 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kern… 61 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.7.2/lib/zeitwerk/core_ext/kernel.rb:34:in `requ… 62 01 /var/www/furima-41578/releases/20250430120605/config/application.rb:4:in `<top (required)>' 63 01 /var/www/furima-41578/releases/20250430120605/Rakefile:4:in `require_relative' 64 01 /var/www/furima-41578/releases/20250430120605/Rakefile:4:in `<top (required)>' 65 01 /var/www/furima-41578/shared/bundle/ruby/3.2.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>' 66 01 /home/ec2-user/.rbenv/versions/3.2.0/bin/bundle:25:in `load' 67 01 /home/ec2-user/.rbenv/versions/3.2.0/bin/bundle:25:in `<main>' 68 01 (See full trace by running task with --trace)

該当のソースコード

ubuntu

1#<Thread:0x00007f19ac9cb7e8 /home/adosan35/projects/furima-41578/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/runners/parallel.rb:8 run> terminated with exception (report_on_exception is true): 2/home/adosan35/projects/furima-41578/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/runners/parallel.rb:13:in `rescue in block (2 levels) in execute': Exception while executing as ec2-user@35.72.177.139: rake exit status: 1 (SSHKit::Runner::ExecuteError) 3rake stdout: Nothing written 4rake stderr: ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system 5 with an unsupported version of glibc.

試したこと・調べたこと

  • teratailやGoogle等で検索した
  • ソースコードを自分なりに変更した
  • 知人に聞いた
  • その他
上記の詳細・結果

AIのcopilotに質問してみたらNokogiriとGLIBCの互換性に問題があると説明が返ってきました。

補足

特になし

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

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

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

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

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

maisumakun

2025/04/30 14:39

エラーメッセージ内に試してみるべきコマンドが書かれていますが、そちらは試してみましたか?
kei0316

2025/05/04 10:03

コメントありがとうございます。もうすでに解決しました!
guest

回答1

0

デプロイ時に行っている

bundle install

の前に

bundle config set force_ruby_platform true

を付けてみてください。

nokogoriはLinux用のネイティブバイナリが用意されているのですが、実行している環境のglibcが古すぎるため、動作しないようです。エラーメッセージにあるとおり、bundle installの前に上のコマンドを実行して、nokogiriがコンパイルされるようにしてみてください。

投稿2025/05/03 07:46

raccy

総合スコア21751

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.31%

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

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

質問する

関連した質問