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

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

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

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

Q&A

解決済

1回答

1407閲覧

bundle install でエラーが出てしまいます。(windows)

nakanoyakuka

総合スコア12

Ruby on Rails 5

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

0グッド

0クリップ

投稿2019/03/26 15:42

前提・実現したいこと

ruby on railsの環境を構築するためにbundle installを実行したいのですが、エラーが出てしまいます。

https://blog.codecamp.jp/rails-for-win
このサイトに従って作業を進めています。

pcはwindows10の64bit、rubyは2.6.1、sqlite3は3.27.2、railsは5.2.2.1です。
コマンドプロンプトを用いて実践しています。

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

上記サイトのgem install railsのところまでは指示通りに進められ、その後Rubyのフォルダにrailsフォルダがなかったので自分で作り、cd C:¥Ruby¥railsを実行し、rails new firstappを実行しました。firstappは問題なく作られていたように思います。そしてcd firstappを実行し、bundle installとしたとき、事件は起こりました。


c:\Ruby\rails\firstapp>bundle install

Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies......
Using rake 12.3.2
Using concurrent-ruby 1.1.5
(中略)
Using sass-rails 5.0.7
Using selenium-webdriver 3.141.0
Fetching sqlite3 1.4.0
Installing sqlite3 1.4.0 with native extensions


ここで一旦インストールが止まり、次の瞬間、


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby/bin/ruby.exe -I C:/Ruby/lib/ruby/2.6.0 -r
./siteconf20190326-8780-him67w.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for dlopen()... no
missing function dlopen
*** 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=C:/Ruby/bin/$(RUBY_BASE_NAME)
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlcipher
--without-sqlcipher
--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-pthreadlib
--without-pthreadlib
--with-dllib
--without-dllib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

C:/Ruby/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/Ruby/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.0 for inspection.
Results logged to
C:/Ruby/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.0/gem_make.out

An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'
succeeds before bundling.

In Gemfile:
sqlite3


このようなエラーが出てしまいました、、、
rails serverを実行しても、


c:\Ruby\rails\firstapp>rails server

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


上記のようなエラーが出てしまいます。

試したこと

エラー文を見ている感じだと、sqlite3がどうやら引っかかっている感じがしたので、まずはc:/Ruby/binにsqlite3.exeとsqlite3.hとsqlite3.dllを置きました。次にコマンドプロンプトに
c:\Ruby\rails\firstapp>gem install sqlite3
と打って実行してみると上記のエラー文と似たようなエラー文が出てきました。
そのエラー文をもとにいろいろ検索してみると、

https://teratail.com/questions/173639

ここに全く同じエラー文で悩んでいる人を見つけました。この回答に沿って
gem install specific_install
gem specific_install -l https://github.com/larskanis/sqlite3-ruby -b add-gemspec
これを実行してみたところ、(gitのpathは通してありました。)どうやらsqlite3はインストールできたようです。が、再度rails serverを実行すると今度は、
Could not find gem 'uglifier (>= 1.3.0) x64-mingw32' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.
と、sqlite3ではなくuglifierとかいうのに阻まれまして、これはbundle installを正常に実行させない限り一生終わらないと悟りました。
なお、この状態でbundle installを実行してもやはりInstalling sqlite3のところで止まり、全く同じエラー文が表示されます。

ちなみになのですが、rails serverのコマンドはc:\Ruby\rails\firstapp>のプロンプトで実行してエラーが出ており、このプロンプトでrail --versionを実行しても、全く同じエラーが出ます。しかし、c:\Ruby\rails>のプロンプトでrail --versionを実行すると、


c:\Ruby\rails>rails --version
Rails 5.2.2.1


このようにちゃんとversionを返してくれます。なぜなのでしょうか、、、

冗長な質問文で申し訳ありませんでしたが、回答よろしくお願いします。また私は、railsは今日初めて触らせていただきましたので知識等はございません。どうぞお手柔らかにお願いします。

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

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

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

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

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

guest

回答1

0

ベストアンサー

同じ質問が何度も出ています。gem sqlite3 のバージョンを下げないと駄目です。
このページの一番上の検索欄に「sqlite3 dlopen」と入れて検索してください。

投稿2019/03/26 16:14

otn

総合スコア84505

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

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

nakanoyakuka

2019/03/27 09:32

返信が遅れて申し訳ありません。迅速な回答ありがとうございました!検索不足で申し訳ありません。 https://teratail.com/questions/174846 こちらの質問の回答を参照して無事解決しました! *** SIGUSR2 not implemented, signal based restart unavailable! *** SIGUSR1 not implemented, signal based restart unavailable! *** SIGHUP not implemented, signal based logs reopening unavailable! という表示が出ましたが、windowsを使っている以上仕方ないようですね。 Yay! I'm on Rails! 本当に感謝しています!!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問