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

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

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

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

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

Q&A

解決済

1回答

1453閲覧

Gemfile.lockのmac用gemの記載を消したい

hi-roto

総合スコア8

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

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

0グッド

0クリップ

投稿2021/12/21 07:18

編集2021/12/21 07:21

実現したいこと
Gemfile.lockのmac用gemを削除したい

現状
gmefile.lockのpratforms部分に記載されているx86_64-darwin-20を削除したが、勝手に挿入され、削除することができません。

実行作業
nginxのdocker-composeを作成して、API通信の動作検証を行おうとローカル環境においてroute.rbに

get 'api' => 'api#success'

を入力後にターミナルで

$ rails routes

を実行したところ、以下のエラーが発生しました。

/Users/daisenotona/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- nokogiri (LoadError)

そこで、私はローカル環境で

bundle install

を実行してみたところ、エラーが改善され、その後の動作検証に問題はなかったのですが、Gemfile.lockにmac用のgemが入ってしまうようになり、Linux用のgemのみ記載されるようにしたいと感がえていますが、この自動更新を改善できず、pratforms部分に記載されているx86_64-darwin-20だけ削除できず詰まっています。

Gemfil

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.0.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' gem 'rails', '~> 6.1.4' # Use mysql as the database for Active Record gem 'mysql2', '~> 0.5' # Use Puma as the app server gem 'puma', '~> 5.0' # 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 # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible # gem 'rack-cors' 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 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 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock

GEM remote: https://rubygems.org/ specs: actioncable (6.1.4.4) actionpack (= 6.1.4.4) activesupport (= 6.1.4.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (6.1.4.4) actionpack (= 6.1.4.4) activejob (= 6.1.4.4) activerecord (= 6.1.4.4) activestorage (= 6.1.4.4) activesupport (= 6.1.4.4) mail (>= 2.7.1) actionmailer (6.1.4.4) actionpack (= 6.1.4.4) actionview (= 6.1.4.4) activejob (= 6.1.4.4) activesupport (= 6.1.4.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (6.1.4.4) actionview (= 6.1.4.4) activesupport (= 6.1.4.4) 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.4.4) actionpack (= 6.1.4.4) activerecord (= 6.1.4.4) activestorage (= 6.1.4.4) activesupport (= 6.1.4.4) nokogiri (>= 1.8.5) actionview (6.1.4.4) activesupport (= 6.1.4.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (6.1.4.4) activesupport (= 6.1.4.4) globalid (>= 0.3.6) activemodel (6.1.4.4) activesupport (= 6.1.4.4) activerecord (6.1.4.4) activemodel (= 6.1.4.4) activesupport (= 6.1.4.4) activestorage (6.1.4.4) actionpack (= 6.1.4.4) activejob (= 6.1.4.4) activerecord (= 6.1.4.4) activesupport (= 6.1.4.4) marcel (~> 1.0.0) mini_mime (>= 1.1.0) activesupport (6.1.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) bootsnap (1.9.3) msgpack (~> 1.0) builder (3.2.4) byebug (11.1.3) concurrent-ruby (1.1.9) crass (1.0.6) erubi (1.10.0) ffi (1.15.4) globalid (1.0.0) activesupport (>= 5.0) i18n (1.8.11) concurrent-ruby (~> 1.0) listen (3.7.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.15.0) msgpack (1.4.2) mysql2 (0.5.3) nio4r (2.5.8) nokogiri (1.12.5-x86_64-linux) racc (~> 1.4) puma (5.5.2) nio4r (~> 2.0) racc (1.6.0) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.1.4.4) actioncable (= 6.1.4.4) actionmailbox (= 6.1.4.4) actionmailer (= 6.1.4.4) actionpack (= 6.1.4.4) actiontext (= 6.1.4.4) actionview (= 6.1.4.4) activejob (= 6.1.4.4) activemodel (= 6.1.4.4) activerecord (= 6.1.4.4) activestorage (= 6.1.4.4) activesupport (= 6.1.4.4) bundler (>= 1.15.0) railties (= 6.1.4.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) railties (6.1.4.4) actionpack (= 6.1.4.4) activesupport (= 6.1.4.4) method_source rake (>= 0.13) thor (~> 1.0) rake (13.0.6) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) spring (4.0.0) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) thor (1.1.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.5.1) PLATFORMS x86_64-darwin-20 ← これを消したいが、削除しても自動で更新されてしまいます x86_64-linux DEPENDENCIES bootsnap (>= 1.4.4) byebug listen (~> 3.3) mysql2 (~> 0.5) puma (~> 5.0) rails (~> 6.1.4) spring tzinfo-data RUBY VERSION ruby 3.0.3p157 BUNDLED WITH 2.2.32

原因
dokcerfialeで作成したrailsの雛形(Linux環境)をローカル環境(MacOS)でbundle installを実行いしたせいで、mac用のgemとLinux用のgemが混在したことが原因だと思っているのですが、これを改善する方法がわからないので、どなたか教えていただけると幸いです。
よろしくお願いします。

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

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

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

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

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

guest

回答1

0

自己解決

railsアプリを再作成して、解消することができました。

投稿2021/12/21 16:16

hi-roto

総合スコア8

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問