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

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

新規登録して質問してみよう
ただいま回答率
85.50%
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回答

1264閲覧

Rails-tutorial の完成済みソースコードを自分のCloud9で動かしたい

oilfriedchicken

総合スコア18

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クリップ

投稿2018/08/05 15:54

編集2018/08/05 16:05

前提・実現したいこと

Rails tutorial のソースコードを自分の cloud9 で動くようにしたい
そのために bundle install を成功させたい

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

Installing pg 0.18.4 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

該当のソースコード

$ bundle install Fetching gem metadata from https://rubygems.org/......... Using rake 12.0.0 Using concurrent-ruby 1.0.5 Using i18n 0.8.6 Using minitest 5.10.3 Using thread_safe 0.3.6 Using tzinfo 1.2.3 Using activesupport 5.1.2 Using builder 3.2.3 Using erubi 1.6.1 Using mini_portile2 2.2.0 Using nokogiri 1.8.0 Using rails-dom-testing 2.0.3 Using loofah 2.0.3 Using rails-html-sanitizer 1.0.3 Using actionview 5.1.2 Using rack 2.0.3 Using rack-test 0.6.3 Using actionpack 5.1.2 Using nio4r 2.1.0 Using websocket-extensions 0.1.2 Using websocket-driver 0.6.5 Using actioncable 5.1.2 Using globalid 0.4.0 Using activejob 5.1.2 Using mime-types-data 3.2016.0521 Using mime-types 3.1 Using mail 2.6.6 Using actionmailer 5.1.2 Using activemodel 5.1.2 Using arel 8.0.0 Using activerecord 5.1.2 Using ansi 1.5.0 Using bindex 0.5.0 Using bundler 1.16.2 Using byebug 9.0.6 Using coderay 1.1.1 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.8.2 Using thor 0.19.4 Using railties 5.1.2 Using coffee-rails 4.2.2 Using ffi 1.9.18 Using formatador 0.2.5 Using rb-fsevent 0.10.2 Using rb-inotify 0.9.10 Using listen 3.0.8 Using lumberjack 1.0.12 Using nenv 0.3.0 Using shellany 0.0.1 Using notiffany 0.1.1 Using slop 3.6.0 Using pry 0.10.4 Using guard 2.13.0 Using guard-compat 1.2.1 Using guard-minitest 2.4.4 Using multi_json 1.12.1 Using jbuilder 2.7.0 Using jquery-rails 4.3.1 Using ruby-progressbar 1.8.1 Using minitest-reporters 1.1.14 Fetching pg 0.18.4 Installing pg 0.18.4 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /usr/local/rvm/gems/ruby-2.4.1/gems/pg-0.18.4/ext /usr/local/rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20180805-23669-1cl2md4.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=/usr/local/rvm/rubies/ruby-2.4.1/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: /usr/local/rvm/gems/ruby-2.4.1/extensions/x86_64-linux/2.4.0/pg-0.18.4/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /usr/local/rvm/gems/ruby-2.4.1/gems/pg-0.18.4 for inspection. Results logged to /usr/local/rvm/gems/ruby-2.4.1/extensions/x86_64-linux/2.4.0/pg-0.18.4/gem_make.out An error occurred while installing pg (0.18.4), and Bundler cannot continue. Make sure that `gem install pg -v '0.18.4' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: pg

ここに問題に対して試したことを記載してください。

brew install postgresql
やら
gem install pg -v '0.18.4'
をすると

Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

current directory: /usr/local/rvm/gems/ruby-2.4.1/gems/pg-0.18.4/ext

/usr/local/rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20180805-23772-18rythe.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.

とでてしまいます、、、

補足情報(FW/ツールのバージョンなど)

質問できているかすら不安ですが大変困っていますので回答よろしくお願いいたしますm(_ _)m

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

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

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

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

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

guest

回答1

0

ベストアンサー

Railstutorialでは開発環境でsqlite、本番環境でpostgresqlを使っているので、
開発環境でbundle installを行うときは

$ bundle install --without production

としてください。

投稿2018/08/06 00:20

退会済みユーザー

退会済みユーザー

総合スコア0

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

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

oilfriedchicken

2018/08/06 15:45

無事解決いたしました。ありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問