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

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

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

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

Q&A

1回答

2319閲覧

ruby on rails環境構築 ターミナルでrails new sample appと打つとgemfileにpumaサーバーのgemがないというメッセージが出ます

kiki142

総合スコア13

Ruby on Rails

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

0グッド

0クリップ

投稿2018/10/10 01:34

編集2022/01/12 10:55

ターミナルでrails new sample appと打つとgemfileにpumaサーバーのgemがないと言うメッセージが来ます、それからbundleinstallしてくださいと書いてました。そのgemfireを修正する方法を教えて頂けると嬉しいです 後コンフリクト?が起きてるそうです                                           

exist

1 identical README.md 2 identical Rakefile 3 identical .ruby-version 4 identical config.ru 5 conflict .gitignore 6Overwrite /Users//sample/.gitignore? (enter "h" for help) [Ynaqdh] 7 force .gitignore 8 identical Gemfile 9 run git init from "." 10 11Reinitialized existing Git repository in /Users//sample/.git/ 12 identical package.json 13 exist app 14 identical app/assets/config/manifest.js 15 identical app/assets/javascripts/application.js 16 identical app/assets/javascripts/cable.js 17 identical app/assets/stylesheets/application.css 18 identical app/channels/application_cable/channel.rb 19 identical app/channels/application_cable/connection.rb 20 identical app/controllers/application_controller.rb 21 identical app/helpers/application_helper.rb 22 identical app/jobs/application_job.rb 23 identical app/mailers/application_mailer.rb 24 identical app/models/application_record.rb 25 identical app/views/layouts/application.html.erb 26 identical app/views/layouts/mailer.html.erb 27 identical app/views/layouts/mailer.text.erb 28 identical app/assets/images/.keep 29 exist app/assets/javascripts/channels 30 identical app/assets/javascripts/channels/.keep 31 identical app/controllers/concerns/.keep 32 identical app/models/concerns/.keep 33 exist bin 34 identical bin/bundle 35 identical bin/rails 36 identical bin/rake 37 identical bin/setup 38 identical bin/update 39 identical bin/yarn 40 exist config 41 identical config/routes.rb 42 identical config/application.rb 43 identical config/environment.rb 44 identical config/cable.yml 45 identical config/puma.rb 46 identical config/spring.rb 47 identical config/storage.yml 48 exist config/environments 49 identical config/environments/development.rb 50 identical config/environments/production.rb 51 identical config/environments/test.rb 52 exist config/initializers 53 identical config/initializers/application_controller_renderer.rb 54 identical config/initializers/assets.rb 55 identical config/initializers/backtrace_silencers.rb 56 identical config/initializers/content_security_policy.rb 57 identical config/initializers/cookies_serializer.rb 58 create config/initializers/cors.rb 59 identical config/initializers/filter_parameter_logging.rb 60 identical config/initializers/inflections.rb 61 identical config/initializers/mime_types.rb 62 create config/initializers/new_framework_defaults_5_2.rb 63 identical config/initializers/wrap_parameters.rb 64 exist config/locales 65 identical config/locales/en.yml 66 67 append .gitignore 68 identical config/boot.rb 69 identical config/database.yml 70 exist db 71 identical db/seeds.rb 72 exist lib 73 exist lib/tasks 74 identical lib/tasks/.keep 75 exist lib/assets 76 identical lib/assets/.keep 77 exist log 78 identical log/.keep 79 exist public 80 identical public/404.html 81 identical public/422.html 82 identical public/500.html 83 identical public/apple-touch-icon-precomposed.png 84 identical public/apple-touch-icon.png 85 identical public/favicon.ico 86 identical public/robots.txt 87 exist tmp 88 identical tmp/.keep 89 exist tmp/cache 90 exist tmp/cache/assets 91 exist vendor 92 identical vendor/.keep 93 exist test/fixtures 94 identical test/fixtures/.keep 95 exist test/fixtures/files 96 identical test/fixtures/files/.keep 97 exist test/controllers 98 identical test/controllers/.keep 99 exist test/mailers 100 identical test/mailers/.keep 101 exist test/models 102 identical test/models/.keep 103 exist test/helpers 104 identical test/helpers/.keep 105 exist test/integration 106 identical test/integration/.keep 107 identical test/test_helper.rb 108 exist test/system 109 identical test/system/.keep 110 identical test/application_system_test_case.rb 111 exist storage 112 identical storage/.keep 113 exist tmp/storage 114 identical tmp/storage/.keep 115 remove config/initializers/cors.rb 116 remove config/initializers/new_framework_defaults_5_2.rb 117 run bundle install 118The 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`. 119Fetching gem metadata from https://rubygems.org/......... 120Fetching gem metadata from https://rubygems.org/. 121Resolving dependencies... 122Bundler could not find compatible versions for gem "activesupport": 123 In snapshot (Gemfile.lock): 124 activesupport (= 4.2.1) 125 126 In Gemfile: 127 rails (~> 5.2.1) was resolved to 5.2.1, which depends on 128 activesupport (= 5.2.1) 129 130 sass-rails (~> 5.0) was resolved to 5.0.7, which depends on 131 railties (< 6, >= 4.0.0) was resolved to 4.2.1, which depends on 132 activesupport (= 4.2.1) 133 134Running `bundle update` will rebuild your snapshot from scratch, using only 135the gems in your Gemfile, which may resolve the conflict. 136 run bundle exec spring binstub --all 137Could not find gem 'puma (~> 3.11)' in any of the gem sources listed in your Gemfile. 138Run `bundle install` to install missing gems. 139コード 140```pcはmacbookです このサイトを参考にしました https://fukatsu.tech/environment-ruby-on-rails うまく環境構築できなかったのであとこれも参考にしました → https://gabekore.org/mac-ruby-rails-overview

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

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

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

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

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

guest

回答1

0

エラーメッセージとしては
x 「gemfileに記載がないよ」
ではなく
o 「gemfileに記載があるgemがインストールされていないよ」
になります。

なので、railsのルートディレクトリで
$ bundle install
しましょう。
(おそらく以前の環境構築時にやってますよね?)

どのドキュメントを見て環境構築しているか、わかりませんが、よく読めば必ず書いてあると思いますよ。
URLなど貼ってもらえればより詳細にわかるかもしれませんね。

投稿2018/10/10 03:10

h_daido

総合スコア824

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

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

h_daido

2018/10/10 11:26

$ bundle updateをした上で再度実行してみるとどうなります?
kiki142

2018/10/10 12:27

同じエラーメッセージです。そして 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`. というメッセージもあるのですがgoogle翻訳で翻訳すると最初に、依存関係tzinfo-data(> = 0)は、Bundlerがインストールしているいずれのプラットフォームでも使用されません。と書いてありました
h_daido

2018/10/10 12:47 編集

だめですか。。。インストールされているgemのコンフリクトを解消すればいいと思うのですが、 $ sudo gem cleanup はどうです? ダメな場合 $ gem list で表示される内容をはってもらえますか?とくにactivesupport
kiki142

2018/10/11 21:49 編集

同じでした、表示されてるactivesupportはactivesupport (5.2.1, 4.2.1)です あとディレクトリで sample appと検索すると色々なファイルが出てくるのでアプリ自体は多分作られています
h_daido

2018/10/11 00:50

ファイルは作られていても、必要なgemをインストールする作業が完了していないのでアプリ作成は完了していないですね。 また、gem cleanupを利用すれば、gemの最新版のみインストールしてくれるので、複数バージョンactivesupport (5.2.1, 4.2.1)があるのはおかしいですね。 この点を調べて解消するほうが早いと思います。
kiki142

2018/10/11 06:21

初心者なのでエラーが起こった時の対処がまだよくわからないのですが、その問題が起こった時ってネットで調べたら出てきますか? 問題が起こった時ってどうしてますか?
kiki142

2018/10/11 06:49

コンフリクトが起こった時にディレクトリに出てくるgemfileにgem 'puma'と書いて、ターミナルでbundle installを実行する対処法があると聞いたのですが、一番最初にgem 'puma'と書けばいいですか? ターミナルと違うのでよくわからないのですがあってますか?
h_daido

2018/10/11 07:45

まず、問題はpumaのインストール以前に発生しています。 まずは Bundler could not find compatible versions for gem "activesupport": こちらから修正していく必要があると思います。 先に情報を整理しておいたほうがいいと思います。 ①エラーが発生するのは、$ bundle install時ではなく、$ rails new sample_app 時に発生している ②発生しているエラーはずっと変わらず、質問内容のエラー ③再度試すときには、作ったsample_appを削除し、$ rails new sample_appをもう一度おこなっている という認識であってますか?
kiki142

2018/10/11 21:56

① $bundler -vと打つとBundler version 1.16.4と出てくるので$ rails new sample_app時に発生しています。②同じエラーです ③ディレクトリ で検索したら出てくるsample appというかファイル群は特に削除してません
kiki142

2018/10/11 22:16

何が起こってるのかよくわかっていない状態なので修正方法とかもよく分からないのですが、どうしたら良いですか? なぜgem cleanupをしたのに複数出るのですか?ネットで調べましたが出てきませんでした
h_daido

2018/10/12 03:43 編集

> なぜgem cleanupをしたのに複数出るのですか?ネットで調べましたが出てきませんでした たしかに難しいですよね!僕も片手間なので、レス遅くなってしまいますが、調べてみますよ。 あとは、一度ファイル軍を削除した場合、もしかするとうまくいくかもしれません。 たとえば、/Users/xxxx/railsフォルダでrails new sample_appとした場合、 /Users/xxxx/rails/sample_appというフォルダができているはずです。 1. このsample_appフォルダを一度削除 2. その上で、/Users/xxxx/railsに移動 3. $ sudo gem cleanup 4. 再度 $ rails new sample_app という流れですね!
kiki142

2018/10/12 04:58

調べていただいて有難うございます感謝です。①sample_appフォルダはディレクトリ で検索し出てきたsample_appと書いてあるファイルをゴミ箱に捨てれば良いですか?後、sample_appと検索するとAVAssetWriter.h AVAssetWriter.h AVMovieTrack.h AVMovieTrack.h ColorSyncTransform.h license.html license.html license.html license.html license.html という紙みたいなファイルが出てくるのですがこれも捨てれば良いですか?
kiki142

2018/10/12 05:00

②/Users/xxxx/railsというのはなんですか?移動の仕方も教えていただければ助かります
退会済みユーザー

退会済みユーザー

2018/10/12 05:41 編集

> なぜgem cleanupをしたのに複数出るのですか?ネットで調べましたが出てきませんでした The cleanup command removes old versions of gems from GEM_HOME that are not required to meet a dependency. If a gem is installed elsewhere in GEM_PATH the cleanup command won’t delete it. If no gems are named all gems in GEM_HOME are cleaned. GEM_PATH とは別の場所にインストールされているgemに関しては cleanupコマンドでは削除されないそうですよ。 https://guides.rubygems.org/command-reference/#gem-cleanup
h_daido

2018/10/12 07:55

> ①sample_appフォルダはディレクトリ で検索し出てきたsample_appと書いてあるファイルをゴミ箱に捨てれば良いですか? sample_appフォルダごとゴミ箱でいいですが、検索結果に表示されているものが、対象のフォルダかはわからないので注意してやってくださいね! (ふつうはrails new した階層に移動して rm -rf などで消しますので。)
h_daido

2018/10/12 07:57

> buta_bottiさん そうなんですね。ありがとうございます!--path オプションとか使ってるのかもしれないですね。
kiki142

2018/10/12 10:14

①rails new した階層に移動して rm -rf などで消す方法を教えていただけると嬉しいですrails new した階層って何ですか?                                  ②/Users/xxxx/railsというのはなんですか?移動の仕方も教えていただければ助かります    GEM_PATHとか--path オプションというのは一体なんですか?解消法はありますか?
h_daido

2018/10/12 11:31

。。。。。。linuxコマンドをご存知ないかんじですか...。ここで教えてもいいんですが、最低限のコマンドくらいは知っておかないと、初心者とはいえ、今後も確実につまってしまいます。 https://qiita.com/lrf141/items/4dadd107c1ac778260e5 くらいはみてもらって勉強したほうがいいと思います。移動の仕方も、ファイルの消し方も、階層についても、そちらで答えがわかるはずです。 --pathオプションはまだ早いです。一歩ずついきましょ。
kiki142

2018/10/13 22:47 編集

ターミナルでrm -r sample_app と打ち、ディレクトリを見るとsample_appというフォルダを検索すると無くなっていたので削除できたと思うのですが、ターミナルでsudo gem cleanup と打ちgem listと打つとactivesupport (5.2.1, 4.2.1)と出て来たのですが、方法間違ってますか?
kiki142

2018/10/13 22:49

/Users/xxxx/railsってなんですか?、linuxコマンド見ても分かりませんでした。理解力低くてすいません
h_daido

2018/10/15 05:08

それはただのパスの例ですね。そのパスでrails new したのであれば、という例です。
kiki142

2018/10/16 01:07

すいません、ターミナルでrm -r sample_app と打ち、ディレクトリを見るとsample_appというフォルダを検索すると無くなっていたので削除できたと思うのですが、ターミナルでsudo gem cleanup と打ちgem listと打つとactivesupport (5.2.1, 4.2.1)と出て来たのですが、方法間違ってますか?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問