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

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

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

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

Q&A

解決済

2回答

16993閲覧

ruby on railsのサーバーが起動しない

yusuke_00

総合スコア20

Ruby on Rails

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

0グッド

2クリップ

投稿2016/08/21 11:07

###前提・実現したいこと
rubyをインストールし、ruby -vで確認済み
Bundlerもインストールしており、-vで確認済み

rails new rails-test
を実行し、
cd rails-test
rails start
を実行したのですが、実装中に以下のエラーメッセージが発生しました。①
また、bundle install をrails-testのディレクトリで実行したのもの、最後のほうでエラーを吐きました。②

###発生している問題・エラーメッセージ①

Could not find gem 'rails (>= 5.0.0.1, ~> 5.0.0)' in any of the gem sources listed in your Gemfile or available on this machine. Run `bundle install` to install missing gems.

###発生している問題・エラーメッセージ②

An error occurred while installing byebug (9.0.5), and Bundler cannot continue. Make sure that `gem install byebug -v '9.0.5'` succeeds before bundling.

###試したこと

###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
gemインストール済み gem -v 2.5.1
bundle -v Bundler version 1.12.5
ruby -v ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
ちなみに、rails-testの前のディレクトリ developでは、railsコマンドは認識してくれます。

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

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

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

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

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

guest

回答2

0

ベストアンサー

bundlerでインストールされるrailsとruby本体のrailsのversionが食い違っているのではないでしょうか。

bash

1bundle install 2bundle update 3bundle exec gem install byebug -v '9.0.5' 4bundle exec rails s

を試してみてください。基本的にbundle execを使わないと開発環境に使用されるgemが揃わないのでエラー吐くことが多いです。bundle installが失敗する場合はGemfileの書き方が悪いかgemのバージョンが悪いかなので,その辺りを注意してみてください。

投稿2016/08/21 16:43

編集2016/08/21 16:47
退会済みユーザー

退会済みユーザー

総合スコア0

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

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

yusuke_00

2016/08/21 16:59

回答ありがとうございます。 bundle exec gem install byebug -v '9.0.5'後以下のエラーを吐きました。 ``` Could not find gem 'rails (>= 5.0.0.1, ~> 5.0.0)' in any of the gem sources listed in your Gemfile or available on this machine. Run `bundle install` to install missing gems. ``` 再度bundle install ``` An error occurred while installing byebug (9.0.5), and Bundler cannot continue. Make sure that `gem install byebug -v '9.0.5'` succeeds before bundling. ``` と、エラーを吐きました。 これの繰り返しです。 gem serverと打つと、http://[::]:8808/が立ち上がり、無事接続出来るのですが、これは別なのですか?
退会済みユーザー

退会済みユーザー

2016/08/21 17:11

それは別物ですね。 GemfileとGemfile.lockの中身も見せてもらっていいですかね。 あと, bundle list | grep -i rails の出力もみせてもらえると助かります。
yusuke_00

2016/08/21 17:35 編集

夜中に、返信ありがとうございます。 ```Gemfile source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use sqlite3 as the database for Active Record gem 'sqlite3' # 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 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] ``` Gemfile.lockは、rails-sampleディレクトリ内には見つかりませんでした。が、他の全くことなるディレクトリ(node expressでの作業)には、スポットライトで見つけることが出来ました。 ```bundle list | grep -i rails Could not find gem 'rails (>= 5.0.0.1, ~> 5.0.0)' in any of the gem sources listed in your Gemfile or ```
退会済みユーザー

退会済みユーザー

2016/08/21 19:22 編集

lockはbundle installが成功していないから生成されていないんだと思います。うーんGemfileも問題なさそうですが,bundlerが壊れてるんですかね。 gem updateを試してみて,一回rm -fr rails-testして,手順をやり直してみてください。またこの時railsが正しくインストールされたかどうか見てみてください。 ちなみに正常であればrails new 時点で自動でbundle installも実行されるはずです。 これでうごかなければgemが壊れてる可能性もあるので,rubyのインストールからやり直したほうがいいかもしれません。
yusuke_00

2016/08/22 06:13

すべて、やり直したら、無事 rails s実行することが、出来ました。 お付き合いありがとうございます。
guest

0

まずは、書いてあるとおりに``gem install byebug -v '9.0.5'`だけ実行してみて、きちんとインストールされるか確認してみてください。

投稿2016/08/21 12:18

maisumakun

総合スコア145183

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

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

yusuke_00

2016/08/21 14:21

回答ありがとうございます。 byebug - v 9.0.5問題なく、インストールされました。 そして、gem server とコマンドを打ったら、サーバー8808が動いたのですが、これは、railsと違うものでしょうか?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問