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

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

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

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

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

解決済

1回答

1321閲覧

railsでのgem依存関係でのエラー

shutainer

総合スコア11

Ruby on Rails

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

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2020/08/19 12:16

rails (5.0.1) ruby(2.4.5)
docker(2.3.0.3)

でのエラーです。
以下のエラーがでたため、理由で、railsを5.0.1に変え、もう一度
docker-compose buildにてイメージを作成しようとしたところ、下記エラーがでました。
(Dockerfileにて、RUN bundle installの記載をして、buildするとinstallするようになっています。)

e-s-mba:rails_udemy_docker_third eishunsudo$ docker-compose build Stopping rails_udemy_docker_third_db_1 ... done e-s-mba:rails_udemy_docker_third eishunsudo$ docker-compose build db uses an image, skipping Building web Step 1/8 : FROM ruby:2.4.5 ---> a14928bdfa34 Step 2/8 : RUN apt-get update -qq && apt-get install -y build-essential nodejs ---> Using cache ---> eebecb17239e Step 3/8 : RUN mkdir /app ---> Using cache ---> 848a33a5584c Step 4/8 : WORKDIR /app ---> Using cache ---> 453cb1f380bf Step 5/8 : COPY Gemfile /app/Gemfile ---> Using cache ---> 66711a675603 Step 6/8 : COPY Gemfile.lock /app/Gemfile.lock ---> Using cache ---> 55773a304dc1 Step 7/8 : RUN bundle install ---> Running in f0d0c15936d7 The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Bundler could not find compatible versions for gem "actionpack": In snapshot (Gemfile.lock): actionpack (= 5.0.0.1) In Gemfile: rails (= 5.0.1) was resolved to 5.0.1, which depends on actionpack (= 5.0.1) sass-rails (~> 5.0) was resolved to 5.0.7, which depends on railties (>= 4.0.0, < 6) was resolved to 5.0.0.1, which depends on actionpack (= 5.0.0.1) Running `bundle update` will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict. ERROR: Service 'web' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 6

https://qiita.com/kents1002/items/b69eb8b82824a2622c9c
上記の記事にあるように、actionpack関係でコンフリクトを起こしているようなのですが、
gemfile.lockを書き換えたらよいのかがわかりません。
ご教示いただけたら幸いです。

GEM remote: https://rubygems.org/ specs: actioncable (5.0.0.1) actionpack (= 5.0.0.1) nio4r (~> 1.2) websocket-driver (~> 0.6.1) actionmailer (5.0.0.1) actionpack (= 5.0.0.1) actionview (= 5.0.0.1) activejob (= 5.0.0.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (5.0.0.1) actionview (= 5.0.0.1) activesupport (= 5.0.0.1) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionview (5.0.0.1) activesupport (= 5.0.0.1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) activejob (5.0.0.1) activesupport (= 5.0.0.1) globalid (>= 0.3.6) activemodel (5.0.0.1) activesupport (= 5.0.0.1) activerecord (5.0.0.1) activemodel (= 5.0.0.1) activesupport (= 5.0.0.1) arel (~> 7.0) activesupport (5.0.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.4) autoprefixer-rails (9.8.6) execjs bindex (0.8.1) bootstrap (4.0.0) autoprefixer-rails (>= 6.0.3) popper_js (>= 1.12.9, < 2) sass (>= 3.5.2) builder (3.2.4) byebug (11.0.1) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.1.7) crass (1.0.6) erubis (2.7.0) execjs (2.7.0) ffi (1.13.1) globalid (0.4.2) activesupport (>= 4.2.0) i18n (0.9.5) concurrent-ruby (~> 1.0) jbuilder (2.10.0) activesupport (>= 5.0.0) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) libv8 (8.4.255.0-x86_64-linux) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) loofah (2.6.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) method_source (1.0.0) mini_mime (1.0.2) mini_portile2 (2.4.0) mini_racer (0.3.1) libv8 (~> 8.4.255) minitest (5.14.1) mysql2 (0.4.10) nio4r (1.2.1) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) popper_js (1.16.0) puma (3.12.6) rack (2.2.3) rack-test (0.6.3) rack (>= 1.0) rails (5.0.0.1) actioncable (= 5.0.0.1) actionmailer (= 5.0.0.1) actionpack (= 5.0.0.1) actionview (= 5.0.0.1) activejob (= 5.0.0.1) activemodel (= 5.0.0.1) activerecord (= 5.0.0.1) activesupport (= 5.0.0.1) bundler (>= 1.3.0, < 2.0) railties (= 5.0.0.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 (5.0.0.1) actionpack (= 5.0.0.1) activesupport (= 5.0.0.1) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (13.0.1) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) spring (2.0.2) activesupport (>= 4.2) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) PLATFORMS ruby DEPENDENCIES bootstrap (~> 4.0.0) byebug coffee-rails (~> 4.2) jbuilder (~> 2.5) jquery-rails listen (~> 3.0.5) mini_racer mysql2 (>= 0.3.18, < 0.5) puma (~> 3.0) rails (~> 5.0.0, >= 5.0.0.1) sass-rails (~> 5.0) spring spring-watcher-listen (~> 2.0.0) turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) web-console BUNDLED WITH 1.16.1

以下Gemfile

source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use mysql as the database for Active Record gem 'mysql2', '>= 0.3.18', '< 0.5' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # 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.5' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development gem 'bootstrap', '~> 4.0.0' gem 'mini_racer' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri end group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console' gem 'listen', '~> 3.0.5' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

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

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

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

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

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

gouf

2020/08/19 12:46

docker-compose build : Step 7 の「RUN bundle install」を「RUN bundle update」に書き換えた場合、何か変化は見られますか?
shutainer

2020/08/19 13:22

ありがとうございます。 実はさっき自己解決しました。 gem 'rails', '5.0.1' gem 'sass-rails' とsass-tail のver指定を外し、 docker-compose exec web bundle exec update として、 docker-compose build その後 docker-compose up -d としたらなぜかできました。 理解できていません。
guest

回答1

0

自己解決

gem 'rails', '5.0.1'
gem 'sass-rails'
とsass-tail のver指定を外し、
docker-compose exec web bundle exec update
として、
docker-compose build
その後
docker-compose up -d
としたらなぜかできました。

投稿2020/08/19 13:22

shutainer

総合スコア11

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問