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

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

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

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

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

Debian

Debianは、Debian GNU/Linux などのOS(オペレーティングシステム)です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

1回答

899閲覧

Docker内のRails環境でRails g~コマンドを実行すると"Could not find pg-0.20.0 in any of the sources~"エラーが出る

morizoh

総合スコア16

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

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

Debian

Debianは、Debian GNU/Linux などのOS(オペレーティングシステム)です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2019/09/01 12:16

編集2019/09/03 11:42

Railsチュートリアル3章の静的ページの作成をDocker for windowsを使って進めているのですが
"rails generate controller StaticPages home help"コマンドを実行すると下記のエラーが発生します。エラーを解消しコマンドを実行するにはどうすればいいでしょうか?

ruby

1root@42e5fc849336:/var/www/sample_app# rails generate controller StaticPages home help 2Could not find pg-0.20.0 in any of the sources 3Run `bundle install` to install missing gems.

実行環境

#OS root@42e5fc849336:/var/www/sample_app# cat /etc/issue Debian GNU/Linux 9 \n \l #ruby root@42e5fc849336:/var/www/sample_app# ruby -v ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] #rails root@42e5fc849336:/var/www/sample_app# rails -v Rails 5.1.6
docker pull ruby:2.5.1

上のコマンドで取得したイメージからコンテナを立ててチュートリアルに沿って
node.jsなどを一つずつインストールしていった状態です。
(DockerFileは場所分かりませんでした。。)

Linux,Docker,Railsどれもど素人で質問になっていないかも知れませんので
必要な情報などリクエスト頂けると幸いです。

追記:bundle installの結果

root@42e5fc849336:/var/www/sample_app# bundle install --without production Using rake 12.3.3 Using concurrent-ruby 1.1.5 Using i18n 1.6.0 Using minitest 5.10.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.1.6 Using builder 3.2.3 Using erubi 1.8.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.4 Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.2.0 Using actionview 5.1.6 Using rack 2.0.7 Using rack-test 1.1.0 Using actionpack 5.1.6 Using nio4r 2.5.1 Using websocket-extensions 0.1.4 Using websocket-driver 0.6.5 Using actioncable 5.1.6 Using globalid 0.4.2 Using activejob 5.1.6 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 5.1.6 Using activemodel 5.1.6 Using arel 8.0.0 Using activerecord 5.1.6 Using ansi 1.5.0 Using bindex 0.8.1 Using bundler 1.16.6 Using byebug 9.0.6 Using coderay 1.1.2 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 0.20.3 Using railties 5.1.6 Using coffee-rails 4.2.2 Using ffi 1.11.1 Using formatador 0.2.5 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.0 Using ruby_dep 1.5.0 Using listen 3.1.5 Using lumberjack 1.0.13 Using nenv 0.3.0 Using shellany 0.0.1 Using notiffany 0.1.3 Using pry 0.12.2 Using guard 2.13.0 Using guard-compat 1.2.1 Using guard-minitest 2.4.4 Using multi_json 1.13.1 Using jbuilder 2.7.0 Using jquery-rails 4.3.1 Using ruby-progressbar 1.10.1 Using minitest-reporters 1.1.14 Using puma 3.9.1 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.1.6 Using rails-controller-testing 1.0.2 Using sass-listen 4.0.0 Using sass 3.7.4 Using tilt 2.0.9 Using sass-rails 5.0.6 Using spring 2.0.2 Using spring-watcher-listen 2.0.1 Using sqlite3 1.3.13 Using turbolinks-source 5.2.0 Using turbolinks 5.0.1 Using uglifier 3.2.0 Using web-console 3.5.1 Bundle complete! 20 Gemfile dependencies, 78 gems now installed. Gems in the group production were not installed. Bundled gems are installed into `/usr/local/bundle`

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

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

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

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

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

unhappychoice

2019/09/01 15:53

エラーメッセージにある通り、 `bundle install` した結果はどうなるでしょうか? `bundle install` 実行で改善しない場合、おそらくその結果が失敗していると思われるので、実行結果を貼っていただけると良いかと思います
guest

回答1

0

bundle install 時に pg が出てないようなので、必要にも関わらずインストールしていないように見えます。

Gemfile に以下を追加することでよいのではないのでしょうか

ruby

1#... 2gem 'pg'

投稿2019/09/04 00:55

unhappychoice

総合スコア1531

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問