前提・実現したいこと
Git HubからクローンしてきたSinatraアプリを実行させたいです。
クローンさせていただいたURL https://github.com/masayoshi-tokumoto/sinatra_line
クローンし、bundle installしたのですが、下記エラーがでました。フォルダ場所は、特に仮想環境などは使っておらず、Macの/Users/user/コードリーディング/sinatra_lineにあります。
発生している問題・エラーメッセージ
/Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find mysql2-0.4.6 in any of the sources (Bundler::GemNotFound) from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!' from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize' from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs' from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for' from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup' from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler.rb:109:in `setup' from /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler.rb:114:in `require' from app.rb:2:in `<main>'
該当のソースコード
ruby
1ruby app.rb
試したこと
①
gem install mysql2 -v '0.4.6'
Fetching: mysql2-0.4.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6/ext/mysql2
/Users/user/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20180503-36384-19peza1.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
checking for mysql_query() in -lmysqlclient... no
mysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.
*** 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/user/.rbenv/versions/2.4.1/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0-static/mysql2-0.4.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6 for inspection.
Results logged to /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0-static/mysql2-0.4.6/gem_make.out
②
sudo aptitude install libmysqld-dev
③
sudo apt-get install bsdgames
どちらも command not foundでした。
参照したもの
https://qiita.com/tsubu-mustard/items/ed0d6a701ed0cacf4c11
(rbenv の使い方などがまだ十分には分かっておらず、それらが原因でエラー対処がよく分かっていないところもあると想像します)
④bundle update
エラー
An error occurred while installing mysql2 (0.5.1), and Bundler cannot continue.
Make sure that gem install mysql2 -v '0.5.1'
succeeds before bundling.
補足情報(FW/ツールのバージョンなど)
現在のGemfile
source "https://rubygems.org"
group :production do
gem "sinatra-activerecord"
gem "activerecord"
gem "bcrypt"
gem "sinatra-contrib"
gem "rack-flash3"
gem "sinatra"
gem "rake"
gem "pry-byebug"
gem "pry-doc"
gem "dotenv"
gem "pg"
end
group :development do
gem "mysql2"
end
環境
macOS High Sierra 10.13.4
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
rbenv 1.1.1
Bundler version 1.16.1
以上となります。
よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/03 12:05
2018/05/03 12:16 編集
2018/05/03 14:10