teratail header banner
teratail header banner
質問するログイン新規登録
Ruby on Rails 5

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

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

Q&A

解決済

1回答

987閲覧

could not find gem 'sqlite3 (~> 1.4)' のエラーが解決できません><

hirozema

総合スコア1

Ruby on Rails 5

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

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

0グッド

0クリップ

投稿2022/08/31 02:18

0

0

前提

ReactとRailsを使って簡単なTODOアプリを作っています。
rails g model todo name is_completed:booleanを実装中に以下のエラーメッセージが発生しました。

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

実現したいこと

  • rails g modelコマンドでモデルを作成したいです

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

could not find gem 'sqlite3 (~> 1.3.6)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. React_Rails_app % rails g model todo name is_completed:boolean Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.

該当のソースコード

# Use sqlite3 as the database for Active Record gem "sqlite3", "~> 1.4"

試したこと

過去の質問でgem 'sqlite3', '~> 1.3.6'に置き換えると解決すると拝見したので変更したり,
bundle install --path vendor/bundleで関係のあるライブラリを vender/bundleにインストールする命令をしたりしましたが解決できませんでした、、、

bundle install --path vendor/bundleをすると以下エラーが出ます Gem::Ext::BuildError: ERROR: Failed to build gem native extension. An error occurred while installing sqlite3 (1.4.4), and Bundler cannot continue.

ぜひお力を貸していただきたいです><m(_ _)m

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

Ruby Rails    yarn react
2.7.0   6.1.4.1 1.22.4 17.0.1

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

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

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

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

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

guest

回答1

0

ベストアンサー

bundle install したときのエラーメッセージはもっと長いと思います。
その最後の方に 「log がここにあるよ、読んでね」 という様ななのがあると思います。
その log に原因と解決のためのヒントが書かれています。大抵は最後の方。
まず、それに従ってみてください。

投稿2022/08/31 02:31

winterboum

総合スコア23653

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

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

hirozema

2022/08/31 02:48

コメントありがとうございますm(_ _)m Gem::Ext::BuildError: ERROR: Failed to build gem native extension. checking for sqlite3.h... yes checking for pthread_create() in -lpthread... yes checking for sqlite3_libversion_number() in -lsqlite3... no sqlite3 is missing. Try 'brew install sqlite3', 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' and check your shared library search path (the location where your sqlite3 shared library is located). *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/〜〜〜/.rbenv/versions/2.7.0/bin/$(RUBY_BASE_NAME) --with-sqlite3-config --without-sqlite3-config --with-pkg-config --without-pkg-config --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib --with-pthread-dir --without-pthread-dir --with-pthread-include --without-pthread-include=${pthread-dir}/include --with-pthread-lib --without-pthread-lib=${pthread-dir}/lib --with-pthreadlib --without-pthreadlib --with-sqlite3lib --without-sqlite3lib To see why this extension failed to compile, please check the mkmf.log which can be found here: An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue. In Gemfile: sqlite3 と出ていてbrew install sqlite3を試してくださいと出ていたので実行しましが解決できませんでした。。 ご教授お願い致しますm(_ _)m
winterboum

2022/08/31 04:03

To see why this extension failed to compile, please check the mkmf.log which can be found here これは読みました?
hirozema

2022/08/31 05:32

log見に行ったのですがよくわかりませんでした、、、 https://qiita.com/sheercat/items/92b1fffd3731e17b1792 の記事で解決しました>< 優しくアドバイスありがとうございましたm(_ _)m
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.30%

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

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

質問する

関連した質問