前提
OS:Windows 10 pro 64ビット
IDE:RubyMine
Rubyのバージョン:ruby-2.6.5-p114
Railsのバージョン:Rails 6.0.2.1
SQLite3のバージョン:3.31.1
###実現したいこと
Railsのサーバーを起動したいのですが以下エラーメッセージが実行画面に出力され困っています。
ご助言をお願いいたします。
プロジェクト作成時のエラーメッセージ
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2/ext/sqlite3 C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20200220-4808-15byun0.rb extconf.rb *** 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:/Ruby26-x64/bin/$(RUBY_BASE_NAME) --with-sqlcipher --without-sqlcipher --with-sqlite3-config --without-sqlite3-config --with-pkg-config --without-pkg-config C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:570:in `try_link' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config' from extconf.rb:35:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2 for inspection. Results logged to C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.2/gem_make.out An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: sqlite3 run bundle binstubs bundler Could not find gem 'sqlite3 (~> 1.4) x64-mingw32' in any of the gem sources listed in your Gemfile. rails webpacker:install 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. プロセスは終了コード 1 で完了しました
###実行ボタンを押したときのエラーメッセージ
C:\Ruby26-x64\bin\ruby.exe "C:/Users/rebirth210/RubymineProjects/haluby/bin/rails" server -b 127.0.0.1 -p 3000 -e development 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.
試したこと
実行ボタンを押したときのエラーメッセージ
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.
↓
翻訳
Gemfileにリストされているgemソースのいずれにもgem 'sqlite3(〜> 1.4)x64-mingw32'が見つかりませんでした。
bundle install
を実行して、欠落しているgemをインストールします。
ターミナルでbundle installのコマンドを実行
Fetching gem metadata from https://rubygems.org/............. Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 13.0.1 Using concurrent-ruby 1.1.6 Using i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Using zeitwerk 2.2.2 Using activesupport 6.0.2.1 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.8 (x64-mingw32) Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Using actionview 6.0.2.1 Using rack 2.2.2 Using rack-test 1.1.0 Using actionpack 6.0.2.1 Using nio4r 2.5.2 Using websocket-extensions 0.1.4 Using websocket-driver 0.7.1 Using actioncable 6.0.2.1 Using globalid 0.4.2 Using activejob 6.0.2.1 Using activemodel 6.0.2.1 Using activerecord 6.0.2.1 Using mimemagic 0.3.4 Using marcel 0.3.3 Using activestorage 6.0.2.1 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailbox 6.0.2.1 Using actionmailer 6.0.2.1 Using actiontext 6.0.2.1 Using public_suffix 4.0.3 Using addressable 2.7.0 Using bindex 0.8.1 Using msgpack 1.3.3 (x64-mingw32) Using bootsnap 1.4.5 Using bundler 2.1.4 Using byebug 11.1.1 Using regexp_parser 1.6.0 Using xpath 3.2.0 Using capybara 3.31.0 Using childprocess 3.0.0 Using ffi 1.12.2 (x64-mingw32) Using jbuilder 2.10.0 Using method_source 0.9.2 Using puma 4.3.1 Using rack-proxy 0.6.5 Using thor 1.0.1 Using railties 6.0.2.1 Using sprockets 4.0.0 Using sprockets-rails 3.2.1 Using rails 6.0.2.1 Using rubyzip 2.2.0 Using sassc 2.2.1 (x64-mingw32) Using tilt 2.0.10 Using sassc-rails 2.1.2 Using sass-rails 6.0.0 Using selenium-webdriver 3.142.7 Fetching sqlite3 1.4.2 Installing sqlite3 1.4.2 with native extensions 以下プロジェクト作成時のエラーメッセージと同文
と出した。
また、https://prog-8.com/docs/rails-env-winを参考にしまして
sqlite3.dllとsqlite3.exeをC:\Ruby26-x64\binにコピペ
起動ボタンを押して実行
上記の実行ボタンを押したときのエラーメッセージが出現
###追記
Gemfileの内容
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.2', '>= 6.0.2.1' # Use sqlite3 as the database for Active Record gem 'sqlite3', '~> 1.4' # Use Puma as the app server gem 'puma', '~> 4.1' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 4.0' # 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.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
あなたの回答
tips
プレビュー