質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

1回答

1591閲覧

cloud9 でbundle install実行後エラーが出る

yachiyo

総合スコア3

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2021/05/16 05:03

前提・実現したいこと

bundle installを実行してエラーが出た後の対処法を知りたいです。
ここに質問の内容を詳しく書いてください。
(例)PHP(CakePHP)で●●なシステムを作っています。
■■な機能を実装中に以下のエラーメッセージが発生しました。

発生している問題・エラーメッセージ

エラーメッセージ

該当のソースコード

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/............
Using rake 12.3.3
Using concurrent-ruby 1.1.8
Using i18n 1.8.10
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.9
Using zeitwerk 2.4.2
Using activesupport 6.0.3
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.5.0
Using racc 1.5.2
Using nokogiri 1.11.3 (x86_64-linux)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.9.1
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.3
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.0.3
Using nio4r 2.5.7
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.3
Using actioncable 6.0.3
Using globalid 0.4.2
Using activejob 6.0.3
Using activemodel 6.0.3
Using activerecord 6.0.3
Using mimemagic 0.3.10
Using marcel 0.3.3
Using activestorage 6.0.3
Using mini_mime 1.1.0
Using mail 2.7.1
Using actionmailbox 6.0.3
Using actionmailer 6.0.3
Using actiontext 6.0.3
Using public_suffix 4.0.6
Using addressable 2.7.0
Using ansi 1.5.0
Using execjs 2.7.0
Using autoprefixer-rails 10.2.4.0
Using bcrypt 3.1.13
Using bindex 0.8.1
Using msgpack 1.4.2
Using bootsnap 1.4.5
Using ffi 1.15.0
Using sassc 2.4.0
Using bootstrap-sass 3.4.1
Using will_paginate 3.1.8
Using bootstrap-will_paginate 1.0.0
Using bundler 1.17.2
Using byebug 11.0.1
Using regexp_parser 1.8.2
Using xpath 3.2.0
Using capybara 3.28.0
Using childprocess 2.0.0
Using coderay 1.1.3
Using faker 2.1.2
Using formatador 0.2.5
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using ruby_dep 1.5.0
Using listen 3.1.5
Using lumberjack 1.2.8
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.3
Using method_source 1.0.0
Using pry 0.14.1
Using thor 1.1.0
Using guard 2.16.2
Using guard-compat 1.2.1
Using guard-minitest 2.4.6
Using jbuilder 2.9.1
Using ruby-progressbar 1.11.0
Using minitest-reporters 1.3.8
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem
native extension.

current directory:
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4/ext
/home/ubuntu/.rvm/rubies/ruby-2.6.3/bin/ruby -I
/home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0
-r ./siteconf20210516-3992-1fdhbc1.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails,
please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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/ubuntu/.rvm/rubies/ruby-2.6.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_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:

/home/ubuntu/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/pg-1.1.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4
for inspection.
Results logged to
/home/ubuntu/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/pg-1.1.4/gem_make.out

An error occurred while installing pg
(1.1.4), and Bundler cannot continue.
Make sure that gem install pg -v '1.1.4' --source 'https://rubygems.org/' succeeds before
bundling.

In Gemfile:
pg

gem install pg -v '1.1.4' Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. current directory: /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4/ext /home/ubuntu/.rvm/rubies/ruby-2.6.3/bin/ruby -I /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0 -r ./siteconf20210516-4471-cb5ukx.rb extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** 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/ubuntu/.rvm/rubies/ruby-2.6.3/bin/$(RUBY_BASE_NAME) --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-pg-config --without-pg-config --with-pg_config --without-pg_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: /home/ubuntu/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/pg-1.1.4/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4 for inspection. Results logged to /home/ubuntu/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/pg-1.1.4/gem_make.out ### 試したこと bundle update gem install pg -v '1.1.4' ### 補足情報(FW/ツールのバージョンなど) 初心者のため対処法がわからず困っています。 3日ほどここで止まっています。 色々と調べても全然わかりませんでした。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

おそらく
https://qiita.com/pugiemonn/items/197301776b68d0445eb7
https://qiita.com/satour/items/e142b7590eec1a649e8b
この辺の記事を見れば参考になるかなと思います。

>初心者のため対処法がわからず困っています。
3日ほどここで止まっています。
色々と調べても全然わかりませんでした。

どの程度の初心者か分からないので、うっとうしいかも知れませんがひとつひとつ解説しておきますね。
私も初心者レベルですので、全て正しいとは限りません。あとで今一度お調べいただけると幸いです。

まずエラーの内容が、

gem install pg -v '1.1.4' Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. current directory: /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4/ext /home/ubuntu/.rvm/rubies/ruby-2.6.3/bin/ruby -I /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0 -r ./siteconf20210516-4471-cb5ukx.rb extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header * 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.

とあります。これを翻訳すると、
・pgのインストール中にエラーが発生しました。
・pg_configがないです。
--with-pg-config=/path/to/pg_configを付けてtry againしてみてください
みたいなことが書いてあります。

pgというのは、postgreSQLという名前のDBの名前です。初心者の方ではHerokuなどの本番環境(実際にデプロイして誰でも見れるようになったサイト環境)などで使われる場合が多いです。
気になるようであればMySQLなどと比較しながら調べてみると良いと思います。

cloud9で練習してみよう、だったり開発環境の場合はsqliteというものを使う事になっていると思います。
詳細は分かりかねますが、おそらくGemfileには

group :development, :test do gem 'sqlite3' end group :production do gem 'pg' end

などと記載をして、種類を使い分けていると思います。
お確かめください。

投稿2021/05/16 05:44

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yachiyo

2021/05/16 07:17

ご丁寧な説明ありがとうございます。 エラーの読み方についてかなり勉強になりました。 掲示してくださったサイトを見て解消できました。 本当に助かりました。 ありがとうございます。
退会済みユーザー

退会済みユーザー

2021/05/16 07:20

良かったです! エラーは嫌なものではなくて解決の糸口ですので、読むことは今後大切になってくると思います~ 頑張ってください!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問