前提
Railsチュートリアル第3章にてRailsを学習しています。
以下の過程でエラーが発生しました。
rails new
で新規アプリを作成- Gemfileを記述
- (
bundle _2.2.17_ config set --local without 'production'
を実行) bundle _2.2.17_ install
を実行bundle update
が必要なので実行するとエラー
sqlite3が見つからないことが原因のようですが、インストールはされているみたいで、何が原因なのかわかりません。
開発環境
MacBook Air (M1, 2020)
macOS Monterey 12.4
該当のソースコード
rb:Gemfile
1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4gem 'rails', '6.0.4' 5gem 'puma', '4.3.6' 6gem 'sass-rails', '5.1.0' 7gem 'webpacker', '4.0.7' 8gem 'turbolinks', '5.2.0' 9gem 'jbuilder', '2.9.1' 10gem 'bootsnap', '1.10.3', require: false 11 12group :development, :test do 13 gem 'sqlite3', '1.4.1' 14 gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] 15end 16 17group :development do 18 gem 'web-console', '4.0.1' 19 gem 'listen', '3.1.5' 20 gem 'spring', '2.1.0' 21 gem 'spring-watcher-listen', '2.0.1' 22end 23 24group :test do 25 gem 'capybara', '3.28.0' 26 gem 'selenium-webdriver', '3.142.4' 27 gem 'webdrivers', '4.1.2' 28 gem 'rails-controller-testing', '1.0.4' 29 gem 'minitest', '5.11.3' 30 gem 'minitest-reporters', '1.3.8' 31 gem 'guard', '2.16.2' 32 gem 'guard-minitest', '2.4.6' 33end 34 35group :production do 36 gem 'pg', '1.1.4' 37end
試したこと
% bundle _2.2.17_ install Fetching gem metadata from https://rubygems.org/........... You have requested: listen = 3.1.5 The bundle currently has listen locked at 3.7.1. Try running `bundle update listen` If you are updating multiple gems in your Gemfile at once, try passing them all to `bundle update` % bundle update Fetching gem metadata from https://rubygems.org/........... . . . Installing sqlite3 1.4.1 (was 1.4.2) with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/neko/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.1/ext/sqlite3 /Users/neko/.rbenv/versions/2.6.6/bin/ruby -I /Users/neko/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20220625-77922-x88s8d.rb extconf.rb checking for sqlite3.h... yes checking for pthread_create() in -lpthread... yes checking for -ldl... 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 . . . To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/neko/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/sqlite3-1.4.1/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/neko/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.1 for inspection. Results logged to /Users/neko/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/sqlite3-1.4.1/gem_make.out An error occurred while installing sqlite3 (1.4.1), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.4.1' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: sqlite3 % brew install sqlite3 Warning: sqlite 3.38.5 is already installed and up-to-date. To reinstall 3.38.5, run: brew reinstall sqlite
エラーログ
字数制限のため警告文の行のみ抜粋
mkmf.log
116 ld: warning: ignoring file /opt/homebrew/Cellar/sqlite/3.38.5/lib/libsqlite3.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 276 ld: warning: ignoring file /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 3101 ld: warning: ignoring file /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

回答3件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。