RoR事始め:失敗記録 結局Bundleできなかった

Ubuntu 22.04

anyenv install

# インストールできる〇〇envを確認する anyenv install --list # 必要な〇〇envをインストールする anyenv install rbenv anyenv install pyenv anyenv install nodenv # シェルを再起動する # 以前使っていた〇〇envはアンインストールするかpathを通らないようにしておくこと exec $SHELL -l

 

sudo apt install curl

curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

 

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

 

 

sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev

 

 

gorails.com

 

 

 

 

qiita.com

zenn.dev

結局Bundleできなかった

 

$ bundle install 
Your Gemfile lists the gem sprockets-rails (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
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/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 13.0.6
Using concurrent-ruby 1.1.10
Using i18n 1.12.0
Using minitest 5.16.3
Using tzinfo 2.0.5
Using activesupport 7.0.4
Using builder 3.2.4
Using erubi 1.11.0
Using mini_portile2 2.8.0
Using racc 1.6.0
Using nokogiri 1.13.8 (x86_64-linux)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.19.0
Using rails-html-sanitizer 1.4.3
Using actionview 7.0.4
Using rack 2.2.4
Using rack-test 2.0.2
Using actionpack 7.0.4
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 7.0.4
Using globalid 1.0.0
Using activejob 7.0.4
Using activemodel 7.0.4
Using activerecord 7.0.4
Using marcel 1.0.2
Using mini_mime 1.1.2
Using activestorage 7.0.4
Using mail 2.7.1
Using timeout 0.3.0
Using net-protocol 0.1.3
Using net-imap 0.3.1
Using net-pop 0.1.2
Using net-smtp 0.3.2
Using actionmailbox 7.0.4
Using actionmailer 7.0.4
Using actiontext 7.0.4
Using public_suffix 5.0.0
Using addressable 2.8.1
Using bindex 0.8.1
Using msgpack 1.6.0
Using bootsnap 1.13.0
Using bundler 2.1.4
Using matrix 0.4.2
Using regexp_parser 2.6.0
Using xpath 3.2.0
Using capybara 3.37.1
Using childprocess 4.1.0
Using io-console 0.5.11
Using reline 0.3.1
Using irb 1.4.2
Using debug 1.6.2
Using method_source 1.0.0
Using thor 1.2.1
Using zeitwerk 2.6.1
Using railties 7.0.4
Using importmap-rails 1.1.5
Using jbuilder 2.11.5
Fetching pg 1.4.4
Installing pg 1.4.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/johny/rorTest/vender/bundle/ruby/2.7.0/gems/pg-1.4.4/ext
/home/johny/.anyenv/envs/rbenv/versions/2.7.1/bin/ruby -I
/home/johny/.anyenv/envs/rbenv/versions/2.7.1/lib/ruby/2.7.0 -r
./siteconf20221020-71598-1ey3te2.rb extconf.rb
Calling libpq with GVL unlocked
checking for pg_config... yes
Using config values from /usr/bin/pg_config
Using libpq from /usr/lib/x86_64-linux-gnu
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:
  sudo apt install libpq-dev
  sudo yum install postgresql-devel
  sudo zypper in postgresql-devel
  sudo pacman -S postgresql-libs

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=/home/johny/.anyenv/envs/rbenv/versions/2.7.1/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-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/johny/rorTest/vender/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/pg-1.4.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/johny/rorTest/vender/bundle/ruby/2.7.0/gems/pg-1.4.4 for inspection.
Results logged to
/home/johny/rorTest/vender/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/pg-1.4.4/gem_make.out

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

In Gemfile:
  pg