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

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

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

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

Q&A

解決済

1回答

2658閲覧

"rails g controller users index show"がエラーになります

air1p1

総合スコア15

Ruby on Rails

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

0グッド

0クリップ

投稿2019/01/05 21:43

前提・実現したいこと

Railsアプリを作成したいのですが、
"rails g controller users index show" を実行すると
エラーが発生します。
rails new で、自動生成はできているようです。
原因と対応策を教えていただけますでしょうか。

ファイル名は"myapp"
参照サイト:https://openbook4.me/projects/92/sections/488

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

$ rails g controller users index show C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/spec_set.rb:87:in `block in materialize': Could not find sqlite3-1.3.13-x64-mingw32 in any of the sources (Bundler::GemNotFound) from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/spec_set.rb:81:in `map!' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/spec_set.rb:81:in `materialize' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/definition.rb:170:in `specs' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/definition.rb:237:in `specs_for' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/definition.rb:226:in `requested_specs' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:108:in `block in definition_method' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:20:in `setup' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler.rb:107:in `setup' from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/setup.rb:20:in `<top (required)>' from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require' from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require' from C:/Users/airi/desktop/github/ruby_lesson/myapp/config/boot.rb:3:in `<top (required)>' from bin/rails:3:in `require_relative' from bin/rails:3:in `<main>'

該当のソースコード

user-PC MINGW64 ~/desktop/github/ruby_lesson/myapp (master) $ rails g controller users index show

試したこと

・rubyの保存場所がおかしいのかと思い、binに移動 → エラー
・sqlite3をアンインストール、再インストール → エラー

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

$ ruby バージョン
ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]

$ 自動生成ファイル
user-PC MINGW64 ~/desktop/github/ruby_lesson/myapp (master)
$ ls
app/ config.ru Gemfile.lock package.json README.md tmp/
bin/ db/ lib/ public/ storage/ vendor/
config/ Gemfile log/ Rakefile test/

$ WindowsでGit Bash利用

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

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

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

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

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

guest

回答1

0

ベストアンサー

bundle install は正常終了しましたか?

エラーメッセージは、sqlite3 がみつからないといっています。
sqlite3 は単にインストールしただけでは rails で利用できるようにはなりません。
Gemfile に sqlit3 アクセスのための gem を使うことを記述し、 その gem を bundle install でインストールすることが必要です。
Geminstall に sqlite3 の gem が記載されていることも確認してください。

投稿2019/01/05 21:53

katoy

総合スコア22324

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

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

air1p1

2019/01/06 00:24 編集

ありがとうございます。 Geminstall には "sqlite3"と記載しました。 再度$ rails g controller users index show を実行したところ、 やはりエラーとなってしまいました。 これも「sqlite3 がみつからない」と言ってますよね・・・ なぜでしょうか・・? C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) $gem 結果 Using bundler 2.0.1 Using sqlite3 1.3.13 (x64-mingw32) Bundle complete! 1 Gemfile dependency, 2 gems now installed.
katoy

2019/01/06 01:27

$ rails g でのエラーでなく、 bundle install でのエラーを教えてほしいほしいです。それを解決せずにいる間は railg g をしてもエラーになるだけです。
air1p1

2019/01/06 04:21

Bundle complete! 16 Gemfile dependencies, 77 gems now installed. とは出たのですが、bundle install もエラーになっているのでしょうか・・? 勉強不足ですみません! $ bundle install Using rake 12.3.2 Using concurrent-ruby 1.1.4 Using i18n 1.4.0 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.2.2 Using builder 3.2.3 Using erubi 1.8.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.0 (x64-mingw32) Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.0.4 Using actionview 5.2.2 Using rack 2.0.6 Using rack-test 1.1.0 Using actionpack 5.2.2 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using websocket-driver 0.7.0 Using actioncable 5.2.2 Using globalid 0.4.1 Using activejob 5.2.2 Using mini_mime 1.0.1 Using mail 2.7.1 Using actionmailer 5.2.2 Using activemodel 5.2.2 Using arel 9.0.0 Using activerecord 5.2.2 Using mimemagic 0.3.3 Using marcel 0.3.3 Using activestorage 5.2.2 Using public_suffix 3.0.3 Using addressable 2.5.2 Using io-like 0.3.0 Using archive-zip 0.11.0 Using bindex 0.5.0 Using msgpack 1.2.4 (x64-mingw32) Using bootsnap 1.3.2 Using bundler 2.0.1 Using byebug 10.0.2 Using regexp_parser 1.3.0 Using xpath 3.2.0 Using capybara 3.12.0 Using ffi 1.9.25 (x64-mingw32) Using childprocess 0.9.0 Using chromedriver-helper 2.1.0 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 0.20.3 Using railties 5.2.2 Using coffee-rails 4.2.2 Using duktape 2.0.1.0 Using multi_json 1.13.1 Using jbuilder 2.8.0 Using puma 3.12.0 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.2.2 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.0 Using rubyzip 1.2.2 Using sass-listen 4.0.0 Using sass 3.7.3 Using tilt 2.0.9 Using sass-rails 5.0.7 Using selenium-webdriver 3.141.0 Using sqlite3 1.3.13 (x64-mingw32) Using turbolinks-source 5.2.0 Using turbolinks 5.2.0 Using tzinfo-data 1.2018.9 Using uglifier 4.1.20 Using web-console 3.7.0 Bundle complete! 16 Gemfile dependencies, 77 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed.
katoy

2019/01/06 05:10

bundle install が成功していること、sqllite の gem も入っていることは確認しました。 https://teratail.com/questions/44920 > sqlite3_nativeがないため、エラー返します。また、sqlite3_nativeを入れても解決できません。 を参考にしてみてください。
air1p1

2019/01/06 09:29

URLありがとうございます。 試してみます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問