82502
### 環境

・ruby 2.7.2  
・rails 6.1.3  
・macOS

### 前提

ポートフォリオ作成のため、現在自作アプリを実装しております。  
AWSデプロイに終えたので、Capistranoでの自動デプロイ実装を行なっております。

この記事を参考に実装しました：  
<https://pikawaka.com/rails/capistrano>

### エラー内容

エラーが発生したのは、自動デプロイコマンド`% bundle exec cap production deploy`実行後になります。  
※文字数がオーバーしたため一部省略しております。

`log/capistrano.log`

```

      INFO START 2021-09-15 16:15:56 +0900 cap production deploy
      INFO ---------------------------------------------------------------------------
     DEBUG [f0733d10] Running [ -d $HOME/.rbenv/versions/2.7.2 ] as ec2-user@13.231.71.172
     DEBUG [f0733d10] Command: [ -d $HOME/.rbenv/versions/2.7.2 ]
     DEBUG [f0733d10] Finished in 0.354 seconds with exit status 0 (successful).
      INFO [41e5e12a] Running /usr/bin/env mkdir -p /tmp as ec2-user@13.231.71.172
     DEBUG [41e5e12a] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env mkdir -p /tmp )
      INFO [41e5e12a] Finished in 0.082 seconds with exit status 0 (successful).
     DEBUG Uploading /tmp/git-ssh-ff371dcacdc6ed58b39a.sh 0.0%
      INFO Uploading /tmp/git-ssh-ff371dcacdc6ed58b39a.sh 100.0%
      INFO [0d6289cc] Running /usr/bin/env chmod 700 /tmp/git-ssh-ff371dcacdc6ed58b39a.sh as ec2-user@13.231.71.172
     DEBUG [0d6289cc] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env chmod 700 /tmp/git-ssh-ff371dcacdc6ed58b39a.sh )
      INFO [0d6289cc] Finished in 0.077 seconds with exit status 0 (successful).
      INFO [26ce24e8] Running /usr/bin/env git ls-remote git@github.com:taddy-korokoro/hana_nav_app.git HEAD as ec2-user@13.231.71.172
     DEBUG [26ce24e8] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-ff371dcacdc6ed58b39a.sh" ; /usr/bin/env git ls-remote git@github.com:taddy-korokoro/hana_nav_app.git HEAD )
     DEBUG [26ce24e8]   374079a4e67c6ecfe25fbb11f071c29664418c36    HEAD
      INFO [26ce24e8] Finished in 1.873 seconds with exit status 0 (successful).
      INFO [96e4d28e] Running /usr/bin/env mkdir -p /var/www/hana_nav_app/shared /var/www/hana_nav_app/releases as ec2-user@13.231.71.172
     DEBUG [96e4d28e] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env mkdir -p /var/www/hana_nav_app/shared /var/www/hana_nav_app/releases )
      INFO [96e4d28e] Finished in 0.032 seconds with exit status 0 (successful).
      INFO [b7a65458] Running /usr/bin/env mkdir -p /var/www/hana_nav_app/shared/log /var/www/hana_nav_app/shared/tmp/pids /var/www/hana_nav_app/shared/tmp/cache /var/www/hana_nav_app/shared/tmp/sockets /var/www/hana_nav_app/shared/vendor/bundle /var/www/hana_nav_app/shared/public/system /var/www/hana_nav_app/shared/public/uploads /var/www/hana_nav_app/shared/public/assets as ec2-user@13.231.71.172
     DEBUG [b7a65458] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env mkdir -p /var/www/hana_nav_app/shared/log /var/www/hana_nav_app/shared/tmp/pids /var/www/hana_nav_app/shared/tmp/cache /var/www/hana_nav_app/shared/tmp/sockets /var/www/hana_nav_app/shared/vendor/bundle /var/www/hana_nav_app/shared/public/system /var/www/hana_nav_app/shared/public/uploads /var/www/hana_nav_app/shared/public/assets )
      INFO [b7a65458] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [7b4fa7e6] Running [ -f /var/www/hana_nav_app/current/REVISION ] as ec2-user@13.231.71.172
     DEBUG [7b4fa7e6] Command: [ -f /var/www/hana_nav_app/current/REVISION ]
     DEBUG [7b4fa7e6] Finished in 0.076 seconds with exit status 1 (failed).
     DEBUG [b27d76c2] Running [ -f /var/www/hana_nav_app/repo/HEAD ] as ec2-user@13.231.71.172
     DEBUG [b27d76c2] Command: [ -f /var/www/hana_nav_app/repo/HEAD ]
     DEBUG [b27d76c2] Finished in 0.074 seconds with exit status 0 (successful).
      INFO The repository mirror is at /var/www/hana_nav_app/repo
     DEBUG [aed914b1] Running if test ! -d /var/www/hana_nav_app/repo; then echo "Directory does not exist '/var/www/hana_nav_app/repo'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [aed914b1] Command: if test ! -d /var/www/hana_nav_app/repo; then echo "Directory does not exist '/var/www/hana_nav_app/repo'" 1>&2; false; fi
     DEBUG [aed914b1] Finished in 0.074 seconds with exit status 0 (successful).
      INFO [bad024b8] Running /usr/bin/env git remote set-url origin git@github.com:taddy-korokoro/hana_nav_app.git as ec2-user@13.231.71.172
     DEBUG [bad024b8] Command: cd /var/www/hana_nav_app/repo && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-ff371dcacdc6ed58b39a.sh" ; /usr/bin/env git remote set-url origin git@github.com:taddy-korokoro/hana_nav_app.git )
      INFO [bad024b8] Finished in 0.080 seconds with exit status 0 (successful).
      INFO [44a94e02] Running /usr/bin/env git remote update --prune as ec2-user@13.231.71.172
     DEBUG [44a94e02] Command: cd /var/www/hana_nav_app/repo && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-ff371dcacdc6ed58b39a.sh" ; /usr/bin/env git remote update --prune )
     DEBUG [44a94e02]   Fetching origin
     DEBUG [44a94e02]   Warning: Permanently added the RSA host key for IP address '52.69.186.44' to the list of known hosts.
      INFO [44a94e02] Finished in 2.540 seconds with exit status 0 (successful).
     DEBUG [78e49200] Running if test ! -d /var/www/hana_nav_app/repo; then echo "Directory does not exist '/var/www/hana_nav_app/repo'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [78e49200] Command: if test ! -d /var/www/hana_nav_app/repo; then echo "Directory does not exist '/var/www/hana_nav_app/repo'" 1>&2; false; fi
     DEBUG [78e49200] Finished in 0.075 seconds with exit status 0 (successful).
      INFO [339ee771] Running /usr/bin/env mkdir -p /var/www/hana_nav_app/releases/20210915071559 as ec2-user@13.231.71.172
     DEBUG [339ee771] Command: cd /var/www/hana_nav_app/repo && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-ff371dcacdc6ed58b39a.sh" ; /usr/bin/env mkdir -p /var/www/hana_nav_app/releases/20210915071559 )
      INFO [339ee771] Finished in 0.079 seconds with exit status 0 (successful).
      INFO [c8242e12] Running /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /var/www/hana_nav_app/releases/20210915071559 as ec2-user@13.231.71.172
     DEBUG [c8242e12] Command: cd /var/www/hana_nav_app/repo && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-ff371dcacdc6ed58b39a.sh" ; /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /var/www/hana_nav_app/releases/20210915071559 )
      INFO [c8242e12] Finished in 0.110 seconds with exit status 0 (successful).
     DEBUG [0d45049f] Running if test ! -d /var/www/hana_nav_app/repo; then echo "Directory does not exist '/var/www/hana_nav_app/repo'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [0d45049f] Command: if test ! -d /var/www/hana_nav_app/repo; then echo "Directory does not exist '/var/www/hana_nav_app/repo'" 1>&2; false; fi
     DEBUG [0d45049f] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [d0ca4bc5] Running /usr/bin/env git rev-list --max-count=1 master as ec2-user@13.231.71.172
     DEBUG [d0ca4bc5] Command: cd /var/www/hana_nav_app/repo && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-ff371dcacdc6ed58b39a.sh" ; /usr/bin/env git rev-list --max-count=1 master )
     DEBUG [d0ca4bc5]   374079a4e67c6ecfe25fbb11f071c29664418c36
     DEBUG [d0ca4bc5] Finished in 0.080 seconds with exit status 0 (successful).
     DEBUG [fc9a9cbc] Running if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [fc9a9cbc] Command: if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi
     DEBUG [fc9a9cbc] Finished in 0.077 seconds with exit status 0 (successful).
      INFO [c8f460e7] Running /usr/bin/env echo "374079a4e67c6ecfe25fbb11f071c29664418c36" > REVISION as ec2-user@13.231.71.172
     DEBUG [c8f460e7] Command: cd /var/www/hana_nav_app/releases/20210915071559 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env echo "374079a4e67c6ecfe25fbb11f071c29664418c36" > REVISION )
      INFO [c8f460e7] Finished in 0.079 seconds with exit status 0 (successful).
      INFO [d8896c08] Running /usr/bin/env mkdir -p /var/www/hana_nav_app/releases/20210915071559 /var/www/hana_nav_app/releases/20210915071559/tmp /var/www/hana_nav_app/releases/20210915071559/vendor /var/www/hana_nav_app/releases/20210915071559/public as ec2-user@13.231.71.172
     DEBUG [d8896c08] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env mkdir -p /var/www/hana_nav_app/releases/20210915071559 /var/www/hana_nav_app/releases/20210915071559/tmp /var/www/hana_nav_app/releases/20210915071559/vendor /var/www/hana_nav_app/releases/20210915071559/public )
      INFO [d8896c08] Finished in 0.078 seconds with exit status 0 (successful).
     DEBUG [a104f91b] Running [ -L /var/www/hana_nav_app/releases/20210915071559/log ] as ec2-user@13.231.71.172
     DEBUG [a104f91b] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/log ]
     DEBUG [a104f91b] Finished in 0.077 seconds with exit status 1 (failed).
     DEBUG [ca9dcac6] Running [ -d /var/www/hana_nav_app/releases/20210915071559/log ] as ec2-user@13.231.71.172
     DEBUG [ca9dcac6] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/log ]
     DEBUG [ca9dcac6] Finished in 0.079 seconds with exit status 0 (successful).
      INFO [e0a60e78] Running /usr/bin/env rm -rf /var/www/hana_nav_app/releases/20210915071559/log as ec2-user@13.231.71.172
     DEBUG [e0a60e78] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env rm -rf /var/www/hana_nav_app/releases/20210915071559/log )
      INFO [e0a60e78] Finished in 0.075 seconds with exit status 0 (successful).
      INFO [0d09d2f4] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/log /var/www/hana_nav_app/releases/20210915071559/log as ec2-user@13.231.71.172
     DEBUG [0d09d2f4] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/log /var/www/hana_nav_app/releases/20210915071559/log )
      INFO [0d09d2f4] Finished in 0.074 seconds with exit status 0 (successful).
     DEBUG [9fbc12bc] Running [ -L /var/www/hana_nav_app/releases/20210915071559/tmp/pids ] as ec2-user@13.231.71.172
     DEBUG [9fbc12bc] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/tmp/pids ]
     DEBUG [9fbc12bc] Finished in 0.077 seconds with exit status 1 (failed).
     DEBUG [85d52185] Running [ -d /var/www/hana_nav_app/releases/20210915071559/tmp/pids ] as ec2-user@13.231.71.172
     DEBUG [85d52185] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/tmp/pids ]
     DEBUG [85d52185] Finished in 0.074 seconds with exit status 0 (successful).
      INFO [4d990d69] Running /usr/bin/env rm -rf /var/www/hana_nav_app/releases/20210915071559/tmp/pids as ec2-user@13.231.71.172
     DEBUG [4d990d69] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env rm -rf /var/www/hana_nav_app/releases/20210915071559/tmp/pids )
      INFO [4d990d69] Finished in 0.076 seconds with exit status 0 (successful).
      INFO [f25558fe] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/tmp/pids /var/www/hana_nav_app/releases/20210915071559/tmp/pids as ec2-user@13.231.71.172
     DEBUG [f25558fe] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/tmp/pids /var/www/hana_nav_app/releases/20210915071559/tmp/pids )
      INFO [f25558fe] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [d6610eee] Running [ -L /var/www/hana_nav_app/releases/20210915071559/tmp/cache ] as ec2-user@13.231.71.172
     DEBUG [d6610eee] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/tmp/cache ]
     DEBUG [d6610eee] Finished in 0.075 seconds with exit status 1 (failed).
     DEBUG [6b871300] Running [ -d /var/www/hana_nav_app/releases/20210915071559/tmp/cache ] as ec2-user@13.231.71.172
     DEBUG [6b871300] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/tmp/cache ]
     DEBUG [6b871300] Finished in 0.076 seconds with exit status 1 (failed).
      INFO [beda094d] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/tmp/cache /var/www/hana_nav_app/releases/20210915071559/tmp/cache as ec2-user@13.231.71.172
     DEBUG [beda094d] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/tmp/cache /var/www/hana_nav_app/releases/20210915071559/tmp/cache )
      INFO [beda094d] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [c3ea716b] Running [ -L /var/www/hana_nav_app/releases/20210915071559/tmp/sockets ] as ec2-user@13.231.71.172
     DEBUG [c3ea716b] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/tmp/sockets ]
     DEBUG [c3ea716b] Finished in 0.074 seconds with exit status 1 (failed).
     DEBUG [1c40dd2f] Running [ -d /var/www/hana_nav_app/releases/20210915071559/tmp/sockets ] as ec2-user@13.231.71.172
     DEBUG [1c40dd2f] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/tmp/sockets ]
     DEBUG [1c40dd2f] Finished in 0.075 seconds with exit status 1 (failed).
      INFO [69877a31] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/tmp/sockets /var/www/hana_nav_app/releases/20210915071559/tmp/sockets as ec2-user@13.231.71.172
     DEBUG [69877a31] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/tmp/sockets /var/www/hana_nav_app/releases/20210915071559/tmp/sockets )
      INFO [69877a31] Finished in 0.078 seconds with exit status 0 (successful).
     DEBUG [536e8dae] Running [ -L /var/www/hana_nav_app/releases/20210915071559/vendor/bundle ] as ec2-user@13.231.71.172
     DEBUG [536e8dae] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/vendor/bundle ]
     DEBUG [536e8dae] Finished in 0.077 seconds with exit status 1 (failed).
     DEBUG [4221b4df] Running [ -d /var/www/hana_nav_app/releases/20210915071559/vendor/bundle ] as ec2-user@13.231.71.172
     DEBUG [4221b4df] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/vendor/bundle ]
     DEBUG [4221b4df] Finished in 0.077 seconds with exit status 1 (failed).
      INFO [8cb408d3] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/vendor/bundle /var/www/hana_nav_app/releases/20210915071559/vendor/bundle as ec2-user@13.231.71.172
     DEBUG [8cb408d3] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/vendor/bundle /var/www/hana_nav_app/releases/20210915071559/vendor/bundle )
      INFO [8cb408d3] Finished in 0.089 seconds with exit status 0 (successful).
     DEBUG [ad9cc880] Running [ -L /var/www/hana_nav_app/releases/20210915071559/public/system ] as ec2-user@13.231.71.172
     DEBUG [ad9cc880] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/public/system ]
     DEBUG [ad9cc880] Finished in 0.078 seconds with exit status 1 (failed).
     DEBUG [b14531e0] Running [ -d /var/www/hana_nav_app/releases/20210915071559/public/system ] as ec2-user@13.231.71.172
     DEBUG [b14531e0] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/public/system ]
     DEBUG [b14531e0] Finished in 0.055 seconds with exit status 1 (failed).
      INFO [ed2ec637] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/public/system /var/www/hana_nav_app/releases/20210915071559/public/system as ec2-user@13.231.71.172
     DEBUG [ed2ec637] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/public/system /var/www/hana_nav_app/releases/20210915071559/public/system )
      INFO [ed2ec637] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [ac7c4e33] Running [ -L /var/www/hana_nav_app/releases/20210915071559/public/uploads ] as ec2-user@13.231.71.172
     DEBUG [ac7c4e33] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/public/uploads ]
     DEBUG [ac7c4e33] Finished in 0.078 seconds with exit status 1 (failed).
     DEBUG [69c07993] Running [ -d /var/www/hana_nav_app/releases/20210915071559/public/uploads ] as ec2-user@13.231.71.172
     DEBUG [69c07993] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/public/uploads ]
     DEBUG [69c07993] Finished in 0.076 seconds with exit status 1 (failed).
      INFO [2f85ef5a] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/public/uploads /var/www/hana_nav_app/releases/20210915071559/public/uploads as ec2-user@13.231.71.172
     DEBUG [2f85ef5a] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/public/uploads /var/www/hana_nav_app/releases/20210915071559/public/uploads )
      INFO [2f85ef5a] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [1179ba34] Running [ -L /var/www/hana_nav_app/releases/20210915071559/public/assets ] as ec2-user@13.231.71.172
     DEBUG [1179ba34] Command: [ -L /var/www/hana_nav_app/releases/20210915071559/public/assets ]
     DEBUG [1179ba34] Finished in 0.075 seconds with exit status 1 (failed).
     DEBUG [d9f57f21] Running [ -d /var/www/hana_nav_app/releases/20210915071559/public/assets ] as ec2-user@13.231.71.172
     DEBUG [d9f57f21] Command: [ -d /var/www/hana_nav_app/releases/20210915071559/public/assets ]
     DEBUG [d9f57f21] Finished in 0.075 seconds with exit status 1 (failed).
      INFO [276d419d] Running /usr/bin/env ln -s /var/www/hana_nav_app/shared/public/assets /var/www/hana_nav_app/releases/20210915071559/public/assets as ec2-user@13.231.71.172
     DEBUG [276d419d] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; /usr/bin/env ln -s /var/www/hana_nav_app/shared/public/assets /var/www/hana_nav_app/releases/20210915071559/public/assets )
      INFO [276d419d] Finished in 0.081 seconds with exit status 0 (successful).
     DEBUG [403a0538] Running if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [403a0538] Command: if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi
     DEBUG [403a0538] Finished in 0.075 seconds with exit status 0 (successful).
      INFO [525364d5] Running $HOME/.rbenv/bin/rbenv exec bundle config --local deployment true as ec2-user@13.231.71.172
     DEBUG [525364d5] Command: cd /var/www/hana_nav_app/releases/20210915071559 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; $HOME/.rbenv/bin/rbenv exec bundle config --local deployment true )
      INFO [525364d5] Finished in 0.266 seconds with exit status 0 (successful).
      INFO [c862170b] Running $HOME/.rbenv/bin/rbenv exec bundle config --local path /var/www/hana_nav_app/shared/bundle as ec2-user@13.231.71.172
     DEBUG [c862170b] Command: cd /var/www/hana_nav_app/releases/20210915071559 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; $HOME/.rbenv/bin/rbenv exec bundle config --local path /var/www/hana_nav_app/shared/bundle )
      INFO [c862170b] Finished in 0.267 seconds with exit status 0 (successful).
      INFO [d8b8fc4a] Running $HOME/.rbenv/bin/rbenv exec bundle config --local without development:test as ec2-user@13.231.71.172
     DEBUG [d8b8fc4a] Command: cd /var/www/hana_nav_app/releases/20210915071559 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; $HOME/.rbenv/bin/rbenv exec bundle config --local without development:test )
      INFO [d8b8fc4a] Finished in 0.268 seconds with exit status 0 (successful).
     DEBUG [9d4662d1] Running if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [9d4662d1] Command: if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi
     DEBUG [9d4662d1] Finished in 0.076 seconds with exit status 0 (successful).
     DEBUG [ddb33dd6] Running $HOME/.rbenv/bin/rbenv exec bundle check as ec2-user@13.231.71.172
     DEBUG [ddb33dd6] Command: cd /var/www/hana_nav_app/releases/20210915071559 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" ; $HOME/.rbenv/bin/rbenv exec bundle check )
     DEBUG [ddb33dd6]   The Gemfile's dependencies are satisfied
     DEBUG [ddb33dd6] Finished in 0.425 seconds with exit status 0 (successful).
      INFO The Gemfile's dependencies are satisfied, skipping installation
     DEBUG [7fc16dc2] Running if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi as ec2-user@13.231.71.172
     DEBUG [7fc16dc2] Command: if test ! -d /var/www/hana_nav_app/releases/20210915071559; then echo "Directory does not exist '/var/www/hana_nav_app/releases/20210915071559'" 1>&2; false; fi
     DEBUG [7fc16dc2] Finished in 0.073 seconds with exit status 0 (successful).
      INFO [6cbb4d82] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as ec2-user@13.231.71.172
     DEBUG [6cbb4d82] Command: cd /var/www/hana_nav_app/releases/20210915071559 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.2" RAILS_ENV="production" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
     DEBUG [6cbb4d82]   rake aborted!
     DEBUG [6cbb4d82]   LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile.
     DEBUG [6cbb4d82]   /var/www/hana_nav_app/shared/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `<main>'
    ・
    ・省略
    ・
    
    /home/ec2-user/.rbenv/versions/2.7.2/bin/bundle:23:in `load'
    /home/ec2-user/.rbenv/versions/2.7.2/bin/bundle:23:in `<main>'
     DEBUG [6cbb4d82]   
    Caused by:
     DEBUG [6cbb4d82]   Gem::LoadError: sqlite3 is not part of the bundle. Add it to your Gemfile.
     DEBUG [6cbb4d82]   /var/www/hana_nav_app/shared/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `<main>'
    ・
    ・省略
    ・
     DEBUG [6cbb4d82]   Tasks: TOP => environment
     DEBUG [6cbb4d82]   (See full trace by running task with --trace)
    
```

### 試したこと

エラー箇所を確認してみると、「Active Record
アダプタの読み込みエラー。依存しているgemがなく、sqlite3がバンドルに含まれていないのでGemfileに追加してください」とのことでした。

Gemfileを確認した所、`group :development, :test`内に`gem 'sqlite3', '~>
1.3.6'`と記述がありました。

もしかしたらと思い、capistrano導入に必要なGemを`group :development`からsqlite3が記述してある`group
:development, :test`に入れ、bundle
installして再度自動デプロイコマンドを実行したのですが、エラー内容は変わらず、、sqlite3のバージョンを`gem 'sqlite3', '~>
1.4'`に変更しても同じでした。

詳しい方がいましたら是非アドバイスいただけると幸いです。  
何卒よろしくお願いします。

### 該当するソースコード

`Gemfile`

```

     source 'https://rubygems.org'
    git_source(:github) { |repo| "https://github.com/#{repo}.git" }
    
    ruby '2.7.2'
    
    ・
    ・
    ・
    
    group :development, :test do
      # Call 'byebug' anywhere in the code to stop execution and get a debugger console
      gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
      # Use sqlite3 as the database for Active Record
      # gem 'sqlite3', '~> 1.4'
      gem 'sqlite3', '~> 1.3.6'
      gem 'bullet'
      gem 'rspec-rails'
      gem 'factory_bot_rails'
    end
    
    group :development do
      # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
      gem 'web-console', '>= 4.1.0'
      # Display performance information such as SQL time and flame graphs for each request in your browser.
      # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
      gem 'rack-mini-profiler', '~> 2.0'
      gem 'listen', '~> 3.3'
      gem 'capistrano'
      gem 'capistrano-rbenv'
      gem 'capistrano-bundler'
      gem 'capistrano-rails'
      gem 'capistrano3-unicorn'
    end
    
    group :test do
      # Adds support for Capybara system testing and selenium driver
      gem 'capybara', '>= 3.26'
      gem 'selenium-webdriver'
      # Easy installation and use of web drivers to run system tests with browsers
      gem 'webdrivers'
    end
    
    group :production do
      gem 'unicorn', '5.4.1'
      # gem 'mysql2'
    end
    
    # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
    gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
    
```
CC BY-SA 4.0
2021-09-15T08:26:37.367
82499
2021-09-15T09:27:34.813
2021-09-15T09:27:34.813
3060
46968
question
ruby-on-rails ruby aws capistrano
Capistranoを使った自動デプロイ実行中のエラーを解決したい
* 現状は`group :development, :test`でsqlite3をインストールする設定になっているので、developmentとtest環境でsqlite3が使われる設定になっています
  * capistranoでのデプロイはproduction環境で実施されるので、現状の設定ではsqlite3は使えません
  * groupのブロック外に`gem 'sqlite3', '~> 1.3.6'`を書くとすべての環境でsqlite3が使えるようになるのでデプロイが進むと思います
CC BY-SA 4.0
2021-09-15T09:15:22.053
82502
2021-09-15T09:15:22.053
205
82499
answer