bundleのインストールで卍で詰んだ話

デプロイを練習しているenoです。

 

教材は「個人開発のための Webサービス公開マニュアル」です。

個人開発のための Webサービス公開マニュアル

 

Ruby on Railsのサンプルプログラム「shuwasystem-rails-heroku」をローカル環境で起動しようとしました。

 

Bundlerのパッケージをインストールするところで

卍で詰みました。死にました。

 

Bundlerのパッケージがインストールできない!!

 

コマンドを実行

bundle install

 

エラー?警告?

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.

Fetching gem metadata from https://rubygems.org/..........

Your bundle is locked to mimemagic (0.3.3), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.3) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.3) that hasn't been removed

in order to install.

user@MacBookPro shuwasystem-rails-heroku % bin/rails db:migrate

Could not find rake-12.3.3 in any of the sources

Run `bundle install` to install missing gems.

 

翻訳したり、ググったり、rbenv、rubyをバージョンアップしてみるも...何も変わらず( ;´Д`)

 

そして、下記の神記事で前進!!

qiita.com

 

サンプルプログラムの「gemfile」の

tzinfo-data行を編集

「gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]」をコメントアウト

 

コマンドを実行

 「bundle update」

 

一発でBundleのインストールではできず。。。

「Fetching gem metadata from https://rubygems.org/...........

Fetching gem metadata from https://rubygems.org/.

Resolving dependencies....

Fetching rake 13.0.6 (was 12.3.3)

Installing rake 13.0.6 (was 12.3.3)

Using concurrent-ruby 1.1.10 (was 1.1.5)

Using i18n 1.10.0 (was 1.6.0)

Fetching minitest 5.15.0 (was 5.11.3)

Installing minitest 5.15.0 (was 5.11.3)

Using thread_safe 0.3.6

Using tzinfo 1.2.9 (was 1.2.5)

Fetching activesupport 5.2.7.1 (was 5.2.3)

Installing activesupport 5.2.7.1 (was 5.2.3)

Using builder 3.2.4 (was 3.2.3)

Using erubi 1.10.0 (was 1.8.0)

Fetching mini_portile2 2.8.0 (was 2.4.0)

Installing mini_portile2 2.8.0 (was 2.4.0)

Using racc 1.6.0

Using nokogiri 1.13.5 (x86_64-darwin) (was 1.10.5)

Using rails-dom-testing 2.0.3

Using crass 1.0.6 (was 1.0.5)

Using loofah 2.17.0 (was 2.3.1)

Using rails-html-sanitizer 1.4.2 (was 1.0.4)

Fetching actionview 5.2.7.1 (was 5.2.3)

Installing actionview 5.2.7.1 (was 5.2.3)

Using rack 2.2.3 (was 2.0.7)

Using rack-test 1.1.0

Fetching actionpack 5.2.7.1 (was 5.2.3)

Installing actionpack 5.2.7.1 (was 5.2.3)

Using nio4r 2.5.8 (was 2.4.0)

Using websocket-extensions 0.1.5 (was 0.1.4)

Using websocket-driver 0.7.5 (was 0.7.1)

Fetching actioncable 5.2.7.1 (was 5.2.3)

Installing actioncable 5.2.7.1 (was 5.2.3)

Using globalid 1.0.0 (was 0.4.2)

Fetching activejob 5.2.7.1 (was 5.2.3)

Installing activejob 5.2.7.1 (was 5.2.3)

Using mini_mime 1.1.2 (was 1.0.2)

Using mail 2.7.1

Fetching actionmailer 5.2.7.1 (was 5.2.3)

Installing actionmailer 5.2.7.1 (was 5.2.3)

Fetching activemodel 5.2.7.1 (was 5.2.3)

Installing activemodel 5.2.7.1 (was 5.2.3)

Using arel 9.0.0

Fetching activerecord 5.2.7.1 (was 5.2.3)

Installing activerecord 5.2.7.1 (was 5.2.3)

Using marcel 1.0.2 (was 0.3.3)

Fetching activestorage 5.2.7.1 (was 5.2.3)

Installing activestorage 5.2.7.1 (was 5.2.3)

Fetching public_suffix 4.0.7 (was 3.1.1)

Installing public_suffix 4.0.7 (was 3.1.1)

Fetching addressable 2.8.0 (was 2.6.0)

Installing addressable 2.8.0 (was 2.6.0)

Fetching io-like 0.3.1 (was 0.3.0)

Installing io-like 0.3.1 (was 0.3.0)

Fetching archive-zip 0.12.0

Installing archive-zip 0.12.0

Fetching bindex 0.8.1

Installing bindex 0.8.1 with native extensions

Fetching msgpack 1.5.1 (was 1.3.0)

Installing msgpack 1.5.1 (was 1.3.0) with native extensions

Fetching bootsnap 1.11.1 (was 1.4.4)

Installing bootsnap 1.11.1 (was 1.4.4) with native extensions

Using bundler 1.17.2

Fetching byebug 11.1.3 (was 11.0.1)

Installing byebug 11.1.3 (was 11.0.1) with native extensions

Fetching matrix 0.4.2

Installing matrix 0.4.2

Fetching regexp_parser 2.3.1 (was 1.6.0)

Installing regexp_parser 2.3.1 (was 1.6.0)

Fetching xpath 3.2.0

Installing xpath 3.2.0

Fetching capybara 3.36.0 (was 3.27.0)

Installing capybara 3.36.0 (was 3.27.0)

Fetching childprocess 4.1.0 (was 1.0.1)

Installing childprocess 4.1.0 (was 1.0.1)

Fetching chromedriver-helper 2.1.1

Installing chromedriver-helper 2.1.1

Fetching coffee-script-source 1.12.2

Installing coffee-script-source 1.12.2

Fetching execjs 2.8.1 (was 2.7.0)

Installing execjs 2.8.1 (was 2.7.0)

Fetching coffee-script 2.4.1

Installing coffee-script 2.4.1

Using method_source 1.0.0 (was 0.9.2)

Using thor 1.2.1 (was 0.20.3)

Fetching railties 5.2.7.1 (was 5.2.3)

Installing railties 5.2.7.1 (was 5.2.3)

Fetching coffee-rails 4.2.2

Installing coffee-rails 4.2.2

Fetching ffi 1.15.5 (was 1.11.1)

Installing ffi 1.15.5 (was 1.11.1) with native extensions

Fetching jbuilder 2.11.5 (was 2.9.1)

Installing jbuilder 2.11.5 (was 2.9.1)

Fetching rb-fsevent 0.11.1 (was 0.10.3)

Installing rb-fsevent 0.11.1 (was 0.10.3)

Fetching rb-inotify 0.10.1 (was 0.10.0)

Installing rb-inotify 0.10.1 (was 0.10.0)

Fetching ruby_dep 1.5.0

Installing ruby_dep 1.5.0

Fetching listen 3.1.5

Installing listen 3.1.5

Fetching pg 1.3.5 (was 1.1.4)

Installing pg 1.3.5 (was 1.1.4) with native extensions

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

 

current directory:

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pg-1.3.5/ext

/Users/user/.rbenv/versions/2.6.3/bin/ruby -I

/Users/user/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r

./siteconf20220508-96894-kfb3k0.rb extconf.rb

Calling libpq with GVL unlocked

checking for pg_config... no

checking for libpq per pkg-config... no

Using libpq from 

checking for libpq-fe.h... no

Can't find the 'libpq-fe.h header

*****************************************************************************

 

Unable to find PostgreSQL client library.

 

Please install libpq or postgresql client package like so:

  brew install libpq

 

or try again with:

  gem install pg -- --with-pg-config=/path/to/pg_config

 

or set library paths manually with:

gem install pg -- --with-pg-include=/path/to/libpq-fe.h/

--with-pg-lib=/path/to/libpq.so/

 

*** 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.6.3/bin/$(RUBY_BASE_NAME)

--with-pg

--without-pg

--enable-gvl-unlock

--disable-gvl-unlock

--enable-windows-cross

--disable-windows-cross

--with-pg-config

--without-pg-config

--with-pg_config

--without-pg_config

--with-libpq-config

--without-libpq-config

--with-pkg-config

--without-pkg-config

--with-pg-dir

--without-pg-dir

--with-pg-include

--without-pg-include=${pg-dir}/include

--with-pg-lib

--without-pg-lib=${pg-dir}/lib

 

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

be found here:

 

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/pg-1.3.5/mkmf.log

 

extconf failed, exit code 1

 

Gem files will remain installed in

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pg-1.3.5 for

inspection.

Results logged to

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/pg-1.3.5/gem_make.out

 

An error occurred while installing pg (1.3.5), and Bundler cannot

continue.

Make sure that `gem install pg -v '1.3.5' --source 'https://rubygems.org/'`

succeeds before bundling.

 

In Gemfile:

  pg

user@MacBookPro shuwasystem-rails-heroku % bundle install --without production

Fetching gem metadata from https://rubygems.org/..........

Your bundle is locked to mimemagic (0.3.3), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.3) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.3) that hasn't been removed

in order to install.

user@MacBookPro shuwasystem-rails-heroku % bundle install --without production

Fetching gem metadata from https://rubygems.org/..........

Your bundle is locked to mimemagic (0.3.3), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.3) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.3) that hasn't been removed

in order to install.

 

更にこちらの神記事のおかげで

インストール成功(つД`)ノ

qiita.com

 

コマンド実行

「bundle install --without production」

bundle update

 

Bundleのインストールができました。

「Bundle complete! 18 Gemfile dependencies, 80 gems now installed.

Gems in the group production were not installed.

Use `bundle info [gemname]` to see where a bundled gem is installed.」

 

やっとRailsのサンプルプログラムが動くようになりました!!

 

プログラミングと関係ない話ですが、

卍でプログラムが動いた時は嬉しいです(つД`)ノ

 

参考記事を公開して下さった方々には感謝!!

bundle installする際のtzinfo-dataのwarningがウザい - Qiita

【Rails】An error occurred while installing pg (1.1.4), and Bundler cannot continue.時の対処法 - Qiita

 

フレームワークは初見なんですが、

卍で検索ゲーですね(つД`)ノ