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

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

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

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

Q&A

解決済

1回答

404閲覧

Ruby on Railsの環境構築(Windows10)で”rails s”コマンドの入力に成功し、localhost:3000にアクセスして繋がるようにしたい

barysan0510

総合スコア1

Ruby on Rails 5

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

0グッド

0クリップ

投稿2020/07/18 12:40

前提・実現したいこと

Ruby on Railsの環境構築(Windows10)

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

ProgateのRuby on Railsの環境構築をしてみよう!(Windows)のページの通りの手順で進めており、bundle installまで成功しましたが、"rails s"を入力すると以下のエラーメッセージが出て、localhost:3000にアクセスしても繋がりません。

C:\Users\こうへい\sample_app>rails s
Beginning in Rails 4, Rails ships with a rails binstub at ./bin/rails that
should be used instead of the Bundler-generated rails binstub.

If you are seeing this message, your binstub at ./bin/rails was generated by
Bundler instead of Rails.

You might need to regenerate your rails binstub locally and add it to source
control:

rails app:update:bin # Bear in mind this generates other binstubs
# too that you may or may not want (like yarn)

If you already have Rails binstubs in source control, you might be
inadvertently overwriting them during deployment by using bundle install
with the --binstubs option.

If your application was created prior to Rails 4, here's how to upgrade:

bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails executables
git add bin # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

bundle binstubs some-gem-name
git add bin/new-executable

Could not find gem 'sqlite3 (~> 1.4) x64-mingw32' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.

該当のソースコード

試したこと

RubyのバージョンをRuby 2.5以下に下げる

補足情報(FW/ツールのバージョンなど)

ruby 2.4.5
Bundler version 2.1.4
Rails 6.0.3.2

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

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

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

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

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

guest

回答1

0

ベストアンサー

Rails6を使うなら、Rubyのバージョンは2.6の方がいいと思います。
(最新の2.7はアラートなどが多いと聞くのでやめた方が良いと思います)
Rubyは2.5以下や2.5未満でないと使えないという記事があるかもしれませんが、古い情報だと思われます。
現に、私はWindows10ですが、Rails6.0.3、Ruby2.6を使っています。
ただ、確かにWindows10&Rails6でRubyのバージョンが低い情報の記事が多い気がするので、2.5や2.4の記事を見るときは随時2.6に合わせるように注意しましょう。

投稿2020/07/18 14:15

編集2020/07/18 14:17
shisha

総合スコア86

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

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

barysan0510

2020/07/20 11:38

Rubyのバージョンを2.6にして再度試しましたが、やはりrails sコマンドでエラーが出ます。 C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
shisha

2020/07/20 13:30

Windows10で「rails server」コマンドを実行したときに「cannot load such file -- sqlite3/sqlite3_native」とエラーが出ることへの対処 - Qiita https://qiita.com/shuhey/items/8cd28aed5906fb5fa6ec ある意味環境構築が1番大変なところだと思いますが、そのエラーは上記の記事で対応できました。記事はv2.5で書かれていますので、都度2.6に書き換える必要があります。
barysan0510

2020/07/21 07:28

”gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:/sqlite-amalgamation-3260000 --with-sqlite3-lib=C:\Ruby26-x64\bin”を実行すると、 C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError) というのが出て、sqlite3_native.soファイルが生成されないです。
shisha

2020/07/21 09:23

自分はわからないので、別に質問記事を立てた方が良いと思います
barysan0510

2020/07/21 14:08

分かりました。ご返答ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問