【解決】An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue. Make sure that gem install sqlite3 -v '1.3.11' succeeds before bundling.

# bundle installでSQLite3がインストールできないエラー

```
$ bundle install
```

したら**SQLite3**でエラー(ターミナル)

```
vagrant@ubuntu-xenial:~/workspace/rails_base_exam/mofmof_exam/mofmof_app$ bundle install
Fetching gem metadata from https://rubygems.org/.............
Fetching additional metadata from https://rubygems.org/..
Using rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 5.0.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using nokogiri 1.6.8
Using rails-dom-testing 2.0.1
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.3
Using actionview 5.0.0
Using rack 2.0.1
Using rack-test 0.6.3
Using actionpack 5.0.0
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using websocket-driver 0.6.4
Using actioncable 5.0.0
Using globalid 0.3.6
Using activejob 5.0.0
Using mime-types-data 3.2016.0521
Using mime-types 3.1
Using mail 2.6.4
Using actionmailer 5.0.0
Using activemodel 5.0.0
Using arel 7.1.0
Using activerecord 5.0.0
Using byebug 9.0.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.8.2
Using thor 0.19.1
Using railties 5.0.0
Using coffee-rails 4.2.1
Using debug_inspector 0.0.2
Using ffi 1.9.14
Using multi_json 1.12.1
Using jbuilder 2.6.0
Using jquery-rails 4.1.1
Using rb-fsevent 0.9.7
Using rb-inotify 0.9.7
Using listen 3.0.8
Using puma 3.6.0
Using bundler 1.7.3
Using sprockets 3.7.0
Using sprockets-rails 3.1.1
Using rails 5.0.0
Using sass 3.4.22
Using tilt 2.0.5
Using sass-rails 5.0.6
Using spring 1.7.2
Using spring-watcher-listen 2.0.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
   current directory: /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11/ext/sqlite3
/home/vagrant/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20191113-14000-7g3my6.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'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=/home/vagrant/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
       --with-sqlite3-dir
       --without-sqlite3-dir
       --with-sqlite3-include
       --without-sqlite3-include=${sqlite3-dir}/include
       --with-sqlite3-lib
       --without-sqlite3-lib=${sqlite3-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/sqlite3-1.3.11/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/sqlite3-1.3.11/gem_make.out
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.3.11' succeeds before bundling.
```

## 解決コマンド

windows

```
$ sudo apt-get install libsqlite3-dev
$ sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include
$ gem install sqlite3 -v '1.3.11'
$ bundle install --path vendor/bundle
```

mac

```
$ brew install libsqlite3-dev
$ gem install sqlite3 -v '1.3.13' -- --with-sqlite3-lib=/usr/lib
$ bundle install --path vendor/bundle
```