STUDY MEMO

学習のメモ書き

<Ruby on Rails> レイアウトテンプレートのデフォルトのhead

過去の描き直し。追加するかも
ここではwebpackerについては詳細は記載しない。
rails6

テンプレートファイルとは

viewファイルのこと。

動的なデータをhtmlに入れるような扱いをされていることからテンプレート(雛形)ファイルと呼ばれる。

レイアウトテンプレートとは

application.htmlのような共通部分がまとめられるようなファイルをレイアウトといい、viewファイルであるので、レイアウトテンプレートとも呼ばれる。

デフォルトでは以下のようなheadになっている。

- head
    = csrf_meta_tags
    = csp_meta_tag
    = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
    = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'

assets/stylesheets/application.cssを参照する、という記載。

webpackerを使用するときは、javascript/packsにあるエンドポイントを利用してcssを取り込むため、stylesheet_pack_tagという記載になる。

stylesheet_pack_tag:https://www.rubydoc.info/gems/webpacker/Webpacker%2FHelper:stylesheet_pack_tag

stylesheet_link_tag:https://railsdoc.com/page/stylesheet_link_tag

'data-turbolinks-track': 'reload':https://techtechmedia.com/turbolinks-rails/

media: 'all':https://reference.hyper-text.org/html5/attribute/media/

app/javascript/packsのapplication.jsを参照するという記載。

https://i.gyazo.com/330af057aa0a3a243d0e3e1e4b1e91f2.png

csp_meta_tag:

クロスサイトスクリプティング攻撃を緩和するコンテンツセキュリティポリシー(Content Security Policy: CSP)を実装。

csrf_meta_tags:

クロスサイトリクエストフォージェリー(Cross-Site Request Forgery: CSRF)攻撃を緩和

参考:

[https://railstutorial.jp/chapters/static_pages?version=6.0#code-application_layout:embed:cite]

[https://railsdoc.com/page/layouts:embed:cite]

<Ruby on Rails> データベースの設定(postgresql)

データベースの接続方法

・config/database.yml
環境変数

両方存在する場合

提供された接続情報が重複している:環境変数が優先
提供された接続情報が競合している:環境変数が優先

両方存在していて、かつconfig/database.ymlが優先されるようにしたい場合、database.ymlで"url"サブキーで明示的にURL接続を指定する。

production:
  url: my_database

production環境では、database.yml内で明示的にENV['DATABASE_URL']を使うのがベストプラクティス。
理由:データベース接続のパスワード等の秘密情報をGitなどのソースコントロールに直接登録するのは望ましくないため。

# config/database.yml
...
production:
  <<: *default
  database: appname_production
  username: appname
  password: <%= ENV['APPNAME_DATABASE_PASSWORD'] %>
  url: <%= ENV['DATABASE_URL'] %>
...

参考文献

Rails アプリケーションを設定する - Railsガイド

< コマンド > heroku

続きは後で書く。

環境設定について

現在の環境設定の値を表示する

$ heroku config
=== app_name Config Vars
DATABASE_URL:
LANG:
RACK_ENV:
RAILS_ENV:
RAILS_LOG_TO_STDOUT:
RAILS_SERVE_STATIC_FILES:
SECRET_KEY_BASE:

$ heroku config:get DATABASE_URL
DATABASE_URLの中身が出力

herokuにcredentials.yml.enc内容を反映

$ heroku config:set RAILS_MASTER_KEY=`cat config/master.key`

pipelineを使っている場合、以下のコマンドでproduction環境に反映できる

$ heroku config:set RAILS_MASTER_KEY=`cat config/master.key` -r production

ログの表示

ログの表示

デフォルトで100行のログを返すため、--num (または -n)オプションで取得するログ行数を指定する。 指定できるのはmax1500行。

$ heroku logs
$ heroku logs -n 行数

リアルタイム tail

最新のログを表示し、アプリからログのライブストリームを表示する。 Ctrl+C を押して戻る。(1時間後自動で戻る。)

$ heroku logs --tail

logのフィルタリング

特定のdynoをフィルタリングで取得。 ベース名(--dyno web など)とフルネーム (--dyno web.1 など)も利用できる。

$ heroku logs --dyno router
--dynoは-dでも可

特定のsourceをフィルタリングで取得。

$ heroku logs --source app
--sourceは-sでも可

組み合わせることもできる。

$ heroku logs --source app --dyno worker
  • -tailと組み合わせることもできる。 リアルタイムストリームを取得する。
$ heroku logs --source app --tail

railsコンソールを開く

$ heroku run rails console

データベース関連

データベースの移行

$ heroku run rake db:migrate

herokuのデータベースをリセットする(pg使用時)

$ heroku pg:reset DATABASE

herokuのデータベースに初期データを入れる

$ heroku run rails db:seed

herokuのデータベースにseedファイルを入れる

$ heroku run rails db:seed

git remoteにherokuを追加

$ heroku git:remote -a herokuのアプリ名

参考文献

https://devcenter.heroku.com/ja/articles/config-vars

ログ記録 | Heroku Dev Center

https://haru890.hateblo.jp/entry/2020/07/07/233322

<Ruby on Rails エラー編> herokuでデプロイするときに発生したエラー2

1回目

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/ruby
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1
-----> Installing dependencies using bundler 2.2.16
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Fetching gem metadata from https://rubygems.org/..........
       Using rake 13.0.3
       Using minitest 5.14.4
       Using zeitwerk 2.4.2
       Using builder 3.2.4
       Using erubi 1.10.0
       Fetching concurrent-ruby 1.1.9
       Using racc 1.5.2
       Using crass 1.0.6
       Using rack 2.2.3
       Using nio4r 2.5.7
       Using websocket-extensions 0.1.5
       Using marcel 1.0.1
       Using mini_mime 1.0.3
       Using public_suffix 4.0.6
       Using aws-eventstream 1.1.1
       Fetching aws-partitions 1.465.0
       Using jmespath 1.4.0
       Using method_source 1.0.0
       Using thor 1.1.0
       Using msgpack 1.4.2
       Using buftok 0.2.0
       Using bundler 2.2.16
       Using unf_ext 0.0.7.7
       Using equalizer 0.0.11
       Using ffi 1.15.1
       Using hashie 4.1.0
       Using hpricot 0.8.6
       Using http-form_data 2.3.0
       Using http_parser.rb 0.6.0
       Using thread_safe 0.3.6
       Using multipart-post 2.1.1
       Using naught 1.1.0
       Using oauth 0.5.6
       Using pg 1.2.3
       Using tilt 2.0.10
       Using semantic_range 3.0.0
       Using simple_oauth 0.3.1
       Using temple 0.8.2
       Using turbolinks-source 5.2.0
       Fetching nokogiri 1.11.7 (x86_64-linux)
       Fetching websocket-driver 0.7.4
       Installing aws-partitions 1.465.0
       Installing websocket-driver 0.7.4 with native extensions
       Installing concurrent-ruby 1.1.9
       Using mail 2.7.1
       Using addressable 2.7.0
       Using puma 5.3.2
       Using rack-test 1.1.0
       Using rack-protection 2.1.0
       Fetching rack-proxy 0.7.0
       Installing rack-proxy 0.7.0
       Using aws-sigv4 1.2.3
       Using bootsnap 1.7.5
       Using unf 0.1.4
       Using ffi-compiler 1.0.1
       Using html2slim 0.2.0
       Using sassc 2.4.0
       Using memoizable 0.4.2
       Using slim 4.1.0
       Using turbolinks 5.2.1
       Using omniauth 2.0.4
       Fetching aws-sdk-core 3.114.1
       Installing aws-sdk-core 3.114.1
       Installing nokogiri 1.11.7 (x86_64-linux)
       Using domain_name 0.5.20190701
       Using http-parser 1.2.3
       Using omniauth-oauth 1.2.0
       Using i18n 1.8.10
       Using tzinfo 2.0.4
       Fetching http-cookie 1.0.4
       Installing http-cookie 1.0.4
       Using omniauth-twitter 1.4.0
       Using sprockets 4.0.2
       Using activesupport 6.1.3.2
       Using http 4.4.1
       Using globalid 0.4.2
       Using activemodel 6.1.3.2
       Using jbuilder 2.11.2
       Using twitter 7.0.0
       Using activejob 6.1.3.2
       Using activerecord 6.1.3.2
       Using aws-sdk-dynamodb 1.60.0
       Using aws-sdk-comprehend 1.46.0
       Using aws-sdk-ses 1.38.0
       Fetching aws-sdk-sqs 1.39.0
       Using aws-record 2.6.0
       Using aws-sessionstore-dynamodb 2.0.1
       Installing aws-sdk-sqs 1.39.0
       Using rails-dom-testing 2.0.3
       Fetching loofah 2.10.0
       Installing loofah 2.10.0
       Using rails-html-sanitizer 1.3.0
       Using actionview 6.1.3.2
       Using actionpack 6.1.3.2
       Using actioncable 6.1.3.2
       Using activestorage 6.1.3.2
       Using actionmailer 6.1.3.2
       Using railties 6.1.3.2
       Using sprockets-rails 3.2.2
       Using actionmailbox 6.1.3.2
       Using actiontext 6.1.3.2
       Using aws-sdk-rails 3.6.0
       Using rails 6.1.3.2
       Using sassc-rails 2.1.2
       Using slim-rails 3.2.0
       Using webpacker 5.4.0
       Using sass-rails 6.0.0
       Bundle complete! 26 Gemfile dependencies, 98 gems now installed.
       Gems in the groups 'development' and 'test' were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Removing autoprefixer-rails (10.2.5.0)
       Removing aws-partitions (1.461.0)
       Removing aws-sdk-core (3.114.0)
       Removing aws-sdk-sqs (1.38.0)
       Removing bootstrap (5.0.1)
       Removing concurrent-ruby (1.1.8)
       Removing execjs (2.7.0)
       Removing http-cookie (1.0.3)
       Removing loofah (2.9.1)
       Removing nokogiri-1.11.5-x86_64 (linux)
       Removing popper_js (2.9.2)
       Removing rack-proxy (0.6.5)
       Removing websocket-driver (0.7.3)
       Bundle completed (6.43s)
       Cleaning up the bundler cache.
-----> Installing node-v12.16.2-linux-x64
-----> Installing yarn-v1.22.4
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       yarn install v1.22.4
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.3.2: The platform "linux" is incompatible with this module.
       info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       [4/4] Building fresh packages...
       Done in 23.95s.
       Compiling...
       Compiled all packs in /tmp/build_984cd8ea/public/packs
       Hash: 02de54a646e5a2a4f51a
       Version: webpack 4.46.0
       Time: 28179ms
       Built at: 06/07/2021 6:06:54 PM
                                                                        Asset       Size  Chunks                                Chunk Names
                                                 css/application-4f8f3a07.css    157 KiB    0, 2  [emitted] [immutable]         application
                                              css/application-4f8f3a07.css.br   16.9 KiB          [emitted]                     
                                              css/application-4f8f3a07.css.gz   23.1 KiB          [emitted]                     
                                    css/stylesheets/result/index-e45bff75.css   46 bytes       1  [emitted] [immutable]         stylesheets/result/index
                                       css/stylesheets/top/index-c27721db.css   3.09 KiB       2  [emitted] [immutable]         stylesheets/top/index
                                    css/stylesheets/top/index-c27721db.css.br  487 bytes          [emitted]                     
                                    css/stylesheets/top/index-c27721db.css.gz  621 bytes          [emitted]                     
                                       js/application-c6f59ac9f9e6d84e14d1.js    248 KiB    0, 2  [emitted] [immutable]  [big]  application
                           js/application-c6f59ac9f9e6d84e14d1.js.LICENSE.txt  731 bytes          [emitted]                     
                                    js/application-c6f59ac9f9e6d84e14d1.js.br   63.3 KiB          [emitted]                     
                                    js/application-c6f59ac9f9e6d84e14d1.js.gz   71.9 KiB          [emitted]                     
                                   js/application-c6f59ac9f9e6d84e14d1.js.map   1.01 MiB    0, 2  [emitted] [dev]               application
                                js/application-c6f59ac9f9e6d84e14d1.js.map.br    237 KiB          [emitted]                     
                                js/application-c6f59ac9f9e6d84e14d1.js.map.gz    279 KiB          [emitted]              [big]  
                          js/stylesheets/result/index-63121d6b6ae70e6127c4.js   1.02 KiB       1  [emitted] [immutable]         stylesheets/result/index
                       js/stylesheets/result/index-63121d6b6ae70e6127c4.js.br  487 bytes          [emitted]                     
                       js/stylesheets/result/index-63121d6b6ae70e6127c4.js.gz  533 bytes          [emitted]                     
                      js/stylesheets/result/index-63121d6b6ae70e6127c4.js.map   4.69 KiB       1  [emitted] [dev]               stylesheets/result/index
                   js/stylesheets/result/index-63121d6b6ae70e6127c4.js.map.br   1.59 KiB          [emitted]                     
                   js/stylesheets/result/index-63121d6b6ae70e6127c4.js.map.gz   1.77 KiB          [emitted]                     
                             js/stylesheets/top/index-b24d65eeae16dbeaac8f.js   1.01 KiB       2  [emitted] [immutable]         stylesheets/top/index
                          js/stylesheets/top/index-b24d65eeae16dbeaac8f.js.br  482 bytes          [emitted]                     
                          js/stylesheets/top/index-b24d65eeae16dbeaac8f.js.gz  525 bytes          [emitted]                     
                         js/stylesheets/top/index-b24d65eeae16dbeaac8f.js.map   4.68 KiB       2  [emitted] [dev]               stylesheets/top/index
                      js/stylesheets/top/index-b24d65eeae16dbeaac8f.js.map.br   1.58 KiB          [emitted]                     
                      js/stylesheets/top/index-b24d65eeae16dbeaac8f.js.map.gz   1.77 KiB          [emitted]                     
                                                                manifest.json    2.8 KiB          [emitted]                     
                                                             manifest.json.br  629 bytes          [emitted]                     
                                                             manifest.json.gz  703 bytes          [emitted]                     
        media/images/akadamakinugasatake-04ddd2527167f8c43cba235efe2d15e9.png    233 KiB          [emitted]                     
                media/images/amigasatake-a0045880245ff738c222123689b941d1.png    171 KiB          [emitted]                     
              media/images/benitengutake-5df2558d6c68efd4e0a8b48f25dba3e3.png    201 KiB          [emitted]                     
                   media/images/kaentake-0cdd4fcaf8fed2b3fcd95b8576a415de.png    509 KiB          [emitted]              [big]  
                media/images/kakishimezi-ae4b6d03dfa8273df8a73192bbef195d.png    503 KiB          [emitted]              [big]  
                 media/images/kanzoutake-aa514dfa626e78d2df9892d4fc2b4154.png    233 KiB          [emitted]                     
                     media/images/kinoko-f10be6dee55e1eb819cd1dea3fe26902.png    117 KiB          [emitted]                     
            media/images/kusaurabenitake-7ac1b93afd48b39bb2044690c8f93de8.png    460 KiB          [emitted]              [big]  
         media/images/sasakurehitoyotake-035a9182816ef54713dac9023d609445.png    349 KiB          [emitted]              [big]  
       media/images/shirotamagotengutake-49f131d360d889ef857590b41043c7e4.png    311 KiB          [emitted]              [big]  
                 media/images/tukiyotake-337979c48dbf4355c1e43d0fdb6b1f90.png    146 KiB          [emitted]                     
       Entrypoint application [big] = css/application-4f8f3a07.css js/application-c6f59ac9f9e6d84e14d1.js js/application-c6f59ac9f9e6d84e14d1.js.map
       Entrypoint stylesheets/result/index = css/stylesheets/result/index-e45bff75.css js/stylesheets/result/index-63121d6b6ae70e6127c4.js js/stylesheets/result/index-63121d6b6ae70e6127c4.js.map
       Entrypoint stylesheets/top/index = css/stylesheets/top/index-c27721db.css js/stylesheets/top/index-b24d65eeae16dbeaac8f.js js/stylesheets/top/index-b24d65eeae16dbeaac8f.js.map
        [0] (webpack)/buildin/module.js 552 bytes {0} [built]
        [1] ./app/javascript/packs/stylesheets/top/index.js 39 bytes {0} {2} [built]
        [2] ./app/javascript/stylesheets/top/index.scss 39 bytes {0} {2} [built]
        [4] ./app/javascript/images/akadamakinugasatake.png 115 bytes {0} [optional] [built]
        [5] ./app/javascript/images/amigasatake.png 107 bytes {0} [optional] [built]
        [6] ./app/javascript/images/benitengutake.png 109 bytes {0} [optional] [built]
        [7] ./app/javascript/images/kaentake.png 104 bytes {0} [optional] [built]
       [18] ./app/javascript/packs/application.js 818 bytes {0} [built]
       [19] (webpack)/buildin/global.js 905 bytes {0} [built]
       [20] ./app/javascript/channels/index.js 205 bytes {0} [built]
       [23] ./app/javascript/stylesheets/application.scss 39 bytes {0} [built]
       [24] ./app/javascript/images sync ^\.\/.*$ 640 bytes {0} [built]
       [25] ./app/javascript/packs/stylesheets/result/index.js 42 bytes {1} [built]
       [26] ./app/javascript/stylesheets/result/index.scss 39 bytes {1} [built]
       [27] ./node_modules/bootstrap/dist/js/bootstrap.esm.js + 55 modules 235 KiB {0} [built]
            |    56 modules
           + 20 hidden modules
       
       WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
       This can impact web performance.
       Assets: 
         media/images/kaentake-0cdd4fcaf8fed2b3fcd95b8576a415de.png (509 KiB)
         media/images/kakishimezi-ae4b6d03dfa8273df8a73192bbef195d.png (503 KiB)
         media/images/kusaurabenitake-7ac1b93afd48b39bb2044690c8f93de8.png (460 KiB)
         media/images/sasakurehitoyotake-035a9182816ef54713dac9023d609445.png (349 KiB)
         media/images/shirotamagotengutake-49f131d360d889ef857590b41043c7e4.png (311 KiB)
         js/application-c6f59ac9f9e6d84e14d1.js (248 KiB)
         js/application-c6f59ac9f9e6d84e14d1.js.map.gz (279 KiB)
       
       WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
       Entrypoints:
         application (405 KiB)
             css/application-4f8f3a07.css
             js/application-c6f59ac9f9e6d84e14d1.js
       
       
       WARNING in webpack performance recommendations: 
       You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
       For more info visit https://webpack.js.org/guides/code-splitting/
       Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/stylesheets/application.scss:
           Entrypoint mini-css-extract-plugin = *
           [0] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/stylesheets/application.scss 2 KiB {0} [built]
               + 1 hidden module
       Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/stylesheets/result/index.scss:
           Entrypoint mini-css-extract-plugin = *
           [0] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/stylesheets/result/index.scss 744 bytes {0} [built]
               + 1 hidden module
       Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/stylesheets/top/index.scss:
           Entrypoint mini-css-extract-plugin = *
           [0] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/stylesheets/top/index.scss 6.88 KiB {0} [built]
           [3] ./app/javascript/images/kinoko.png 102 bytes {0} [built]
               + 2 hidden modules
       Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!node_modules/bootstrap/scss/bootstrap.scss:
           Entrypoint mini-css-extract-plugin = *
              2 modules
       
       Asset precompilation completed (57.38s)
       Cleaning assets
       Running: rake assets:clean
-----> Detecting rails configuration
###### WARNING:
       Removing `vendor/bundle`.
       Checking in `vendor/bundle` is not supported. Please remove this directory
       and add it to your .gitignore. To vendor your gems with Bundler, use
       `bundle pack` instead.
###### WARNING:
       No Procfile detected, using the default web server.
       We recommend explicitly declaring how to boot your server process via a Procfile.
       https://devcenter.heroku.com/articles/ruby-default-web-server
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> console, rake, web
-----> Compressing...
       Done: 96.8M
-----> Launching...
       Released v19
       https://app.herokuapp.com/ deployed to Heroku

assetsとwebpackerで干渉している?とのことで、今回参考文献で記載されているgemに該当していたbootstrapを削除。
yarnでbootstrapを入れていたことを忘れていた。

2回目

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/ruby
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1
-----> Installing dependencies using bundler 2.2.16
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
       is x86_64-linux. Add the current platform to the lockfile with `bundle lock
       --add-platform x86_64-linux` and try again.
       Bundler Output: Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
       is x86_64-linux. Add the current platform to the lockfile with `bundle lock
       --add-platform x86_64-linux` and try again.
 !
 !     Failed to install gems via Bundler.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed
$ bundle lock --add-platform x86_64-linux

指示に従ってを実行。
Bundler 2.2.x以降は適切なプラットフォームを追加する必要がある、とのこと。
bundle -vで確認したらBundler version 2.2.19だった。

参考文献

Ruby on Rails - assets:precompile RAILS_ENV=productionを実行するとWARNING in asset size limitという警告が表示される|teratail

【Rails】Bundler 2.2.x以降は開発者が適切なプラットフォームを追加する必要がある - AUTOVICE

< Ruby エラー編 > rbenv globalでversion変更ができなくなった

エラー内容

rbenv globalでversion変更ができなかった。

$ rbenv versions                                                                                                            
  system
  2.3.1
  2.6.3
  2.6.4
  2.6.5
* 2.6.6 (set by /Users/user_name/.ruby-version)
  3.0.1
$ rbenv global 3.0.1                                                                                                  
$ rbenv versions                                                                                                            
  system
  2.3.1
  2.6.3
  2.6.4
  2.6.5
* 2.6.6 (set by /Users/user_name/.ruby-version)
  3.0.1

対処法

ホームディレクトリで$rbenv local [version]をしてしまったことが原因。 versionの読み取り先がrbenv localを実行してしまったため、カレントディレクトリに.ruby-versionというファイルが作成されてしまい、globalの設定がオーバーライドされてしまったため発生したと考えられる。 $ rbenv local --unsetを実行すると、無事にrbenv globalでバージョン変更ができた。

$ rbenv local --unset
$ rbenv version                                                                                                             
3.0.1 (set by /Users/user_name/.rbenv/version) # setされる場所が変わった
$ ruby -v                                                                                                                   
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]

参考

rbenvのよく使うコマンドまとめ - TASK NOTES

rbenv | global と local と .ruby-version の微妙な関係 - Qiita

GitHub - rbenv/rbenv: Groom your app’s Ruby environment

<Ruby on Rails エラー編> herokuでデプロイするときに発生したエラー

1回目

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
 !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
            Detected buildpacks: Ruby,Node.js
            See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.6.6
-----> Installing dependencies using bundler 2.2.16
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Your Gemfile lists the gem aws-sdk-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.
       Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
       is x86_64-linux. Add the current platform to the lockfile with `bundle lock
       --add-platform x86_64-linux` and try again.
       Bundler Output: Your Gemfile lists the gem aws-sdk-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.
       Your bundle only supports platforms ["x86_64-darwin-20"] but your local platform
       is x86_64-linux. Add the current platform to the lockfile with `bundle lock
       --add-platform x86_64-linux` and try again.
 !
 !     Failed to install gems via Bundler.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

Your Gemfile lists the gem aws-sdk-rails (>= 0) more than once.

から、gemfileで重複していたaws-sdk-railsを削除

ここで、herokuでサポートされている最新のバージョンのruby3.0.1になっていなかったことに気づいて変更して、念の為もう一度heroku push

https://devcenter.heroku.com/articles/ruby-support#ruby-versions

2回目

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
 !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
            Detected buildpacks: Ruby,Node.js
            See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1
-----> Installing dependencies using bundler 2.2.16
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Fetching gem metadata from https://rubygems.org/..........
       Fetching rake 13.0.3
〜省略〜
   
       Installing bootstrap 5.0.1
       Bundle complete! 27 Gemfile dependencies, 102 gems now installed.
       Gems in the groups 'development' and 'test' were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Bundle completed (163.23s)
       Cleaning up the bundler cache.
-----> Installing node-v12.16.2-linux-x64
-----> Installing yarn-v1.22.4
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       yarn install v1.22.4
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.3.2: The platform "linux" is incompatible with this module.
       info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > bootstrap@5.0.1" has unmet peer dependency "@popperjs/core@^2.9.2".
       [4/4] Building fresh packages...
       Done in 25.96s.
       I, [2021-06-02T13:39:00.278337 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
       I, [2021-06-02T13:39:00.278779 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
       I, [2021-06-02T13:39:00.279173 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/akadamakinugasatake-71fb3883dd6034b8c25182024af2570fcee1b197d41f46cfefc1c27cf6a8a291.png
       I, [2021-06-02T13:39:00.280564 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/amigasatake-35f500506e096388078ca5e01fd8a5c77d9b6c2dfde2252ead103b0e1d693882.png
       I, [2021-06-02T13:39:00.281103 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/benitengutake-5ea4ad04569b1041a0795c6d7492cff6bd59da8e23fef0733a2ccc4408802062.png
       I, [2021-06-02T13:39:00.281563 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/kaentake-657e92355edef4df6ff742bf63253b1d75c1b307bce7f9aeb8cbb486e3c97c92.png
       I, [2021-06-02T13:39:00.282130 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/kakishimezi-50878dfc4a10eb4b7060f63145e3ac79f24895829c0aefeb2909b31fec312a7c.png
       I, [2021-06-02T13:39:00.282721 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/kanzoutake-1a95e01d3d1565f363cb6067bb9988997d887d538b21cf1f48082dc0bbcbd3f8.png
       I, [2021-06-02T13:39:00.283140 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/kinoko-e06a2b4e2ae765e65a693926cbe0b822e20d9d4b4e78028250873f4639631191.png
       I, [2021-06-02T13:39:00.283706 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/kusaurabenitake-229be4a8d30c315b6931a6e28f6c39eea81214eda66a5e4f2e544ff686122e8b.png
       I, [2021-06-02T13:39:00.284441 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/sasakurehitoyotake-38fa61cfb566349ebf4948bbe31721c37326aa5531d2e82b783387c73c200eaa.png
       I, [2021-06-02T13:39:00.285108 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/shirotamagotengutake-cc81a8733a62bdd9b030b96a600fb5b4a455d966571d01007ec076358c036c28.png
       I, [2021-06-02T13:39:00.285841 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/tukiyotake-b8a617bf1aeb2ada4fe0d0637580c20f58951030e6bf2945794c5a0d10815c4b.png
       I, [2021-06-02T13:39:00.286249 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/application-46fde15497d4d5e232ff92d0eb558d7b04222e2d34c1e808f5c4a001108f768b.css
       I, [2021-06-02T13:39:00.286501 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/application-46fde15497d4d5e232ff92d0eb558d7b04222e2d34c1e808f5c4a001108f768b.css.gz
       I, [2021-06-02T13:39:00.286778 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/balloon-b98683eaa7c4aa99affca3e3353efd18a77b961b6a87e2f361cd3dd1dac24171.css
       I, [2021-06-02T13:39:00.286961 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/balloon-b98683eaa7c4aa99affca3e3353efd18a77b961b6a87e2f361cd3dd1dac24171.css.gz
       I, [2021-06-02T13:39:00.287262 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/results-a660d06b2b728f702540e3cac59b1eb4633b469c977cf8041bed8a4c9a86d20e.css
       I, [2021-06-02T13:39:00.287834 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/results-a660d06b2b728f702540e3cac59b1eb4633b469c977cf8041bed8a4c9a86d20e.css.gz
       I, [2021-06-02T13:39:00.288123 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/top-3ae5747852a558743cc03d6130525f9e639e7583fc17957dabcb9d68afbf367d.css
       I, [2021-06-02T13:39:00.288361 #1481]  INFO -- : Writing /tmp/build_0e8c3275/public/assets/top-3ae5747852a558743cc03d6130525f9e639e7583fc17957dabcb9d68afbf367d.css.gz
       Compiling...
       Compilation failed:
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
       The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
        ["@babel/plugin-proposal-private-methods", { "loose": true }]
       to the "plugins" section of your Babel config.
       ModuleNotFoundError: Module not found: Error: Can't resolve '@popperjs/core' in '/tmp/build_0e8c3275/node_modules/bootstrap/dist/js'
           at /tmp/build_0e8c3275/node_modules/webpack/lib/Compilation.js:925:10
           at /tmp/build_0e8c3275/node_modules/webpack/lib/NormalModuleFactory.js:401:22
           at /tmp/build_0e8c3275/node_modules/webpack/lib/NormalModuleFactory.js:130:21
           at /tmp/build_0e8c3275/node_modules/webpack/lib/NormalModuleFactory.js:224:22
           at /tmp/build_0e8c3275/node_modules/neo-async/async.js:2830:7
           at /tmp/build_0e8c3275/node_modules/neo-async/async.js:6877:13
           at /tmp/build_0e8c3275/node_modules/webpack/lib/NormalModuleFactory.js:214:25
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:213:14
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:41:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
           at /tmp/build_0e8c3275/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
           at _next42 (eval at create (/tmp/build_0e8c3275/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
       resolve '@popperjs/core' in '/tmp/build_0e8c3275/node_modules/bootstrap/dist/js'
         Parsed request is a module
         using description file: /tmp/build_0e8c3275/node_modules/bootstrap/package.json (relative path: ./dist/js)
           Field 'browser' doesn't contain a valid alias configuration
           resolve as module
             looking for modules in /tmp/build_0e8c3275/app/javascript
               using description file: /tmp/build_0e8c3275/package.json (relative path: ./app/javascript)
                 Field 'browser' doesn't contain a valid alias configuration
                 using description file: /tmp/build_0e8c3275/package.json (relative path: ./app/javascript/@popperjs/core)
                   no extension
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core doesn't exist
                   .mjs
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.mjs doesn't exist
                   .js
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.js doesn't exist
                   .sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.sass doesn't exist
                   .scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.scss doesn't exist
                   .css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.css doesn't exist
                   .module.sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.module.sass doesn't exist
                   .module.scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.module.scss doesn't exist
                   .module.css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.module.css doesn't exist
                   .png
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.png doesn't exist
                   .svg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.svg doesn't exist
                   .gif
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.gif doesn't exist
                   .jpeg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.jpeg doesn't exist
                   .jpg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core.jpg doesn't exist
                   as directory
                     /tmp/build_0e8c3275/app/javascript/@popperjs/core doesn't exist
             /tmp/build_0e8c3275/node_modules/bootstrap/dist/js/node_modules doesn't exist or is not a directory
             /tmp/build_0e8c3275/node_modules/bootstrap/dist/node_modules doesn't exist or is not a directory
             /tmp/build_0e8c3275/node_modules/bootstrap/node_modules doesn't exist or is not a directory
             /tmp/build_0e8c3275/node_modules/node_modules doesn't exist or is not a directory
             /tmp/node_modules doesn't exist or is not a directory
             /node_modules doesn't exist or is not a directory
             looking for modules in /tmp/build_0e8c3275/node_modules
               using description file: /tmp/build_0e8c3275/package.json (relative path: ./node_modules)
                 Field 'browser' doesn't contain a valid alias configuration
                 using description file: /tmp/build_0e8c3275/package.json (relative path: ./node_modules/@popperjs/core)
                   no extension
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core doesn't exist
                   .mjs
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.mjs doesn't exist
                   .js
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.js doesn't exist
                   .sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.sass doesn't exist
                   .scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.scss doesn't exist
                   .css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.css doesn't exist
                   .module.sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.module.sass doesn't exist
                   .module.scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.module.scss doesn't exist
                   .module.css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.module.css doesn't exist
                   .png
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.png doesn't exist
                   .svg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.svg doesn't exist
                   .gif
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.gif doesn't exist
                   .jpeg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.jpeg doesn't exist
                   .jpg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_0e8c3275/node_modules/@popperjs/core.jpg doesn't exist
                   as directory
                     /tmp/build_0e8c3275/node_modules/@popperjs/core doesn't exist
       
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): 
you can silence this warning by explicitly adding ["@babel/plugin-proposal-private-methods”,  { "loose": true }] to the "plugins" section of your Babel config.

babel/preset-env設定で "loose"オプションが "false"に設定されていますが、@babel/plugin-proposal-class-properties の "loose" モードオプションが "true" に設定されているため、@babel/plugin-proposal-private-methodsでは使用されません。
babel/plugin-proposal-class-properties、@babel/plugin-proposal-private-methods、および @babel/plugin-proposal-property-in-object(これらが有効な場合)では、"loose"オプションは同じでなければなりません。
Babel/plugin-proposal-private-methods", { "loose": true }] を、あなたの Babel コンフィグの "plugins" セクションに明示的に追加することで、この警告を黙らせることができます。

ということなので、

https://github.com/nuxt/nuxt.js/issues/9224

を参考に、pluginsのところへ明示的に記入。

babel.config.js

...
plugins: [
    ["@babel/plugin-proposal-private-methods", { loose: true }],
...

またgit push heroku 作業ブランチ:mainすると、エラーが変わった。

3回目

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
 !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
            Detected buildpacks: Ruby,Node.js
            See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1
-----> Installing dependencies using bundler 2.2.16
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Fetching gem metadata from https://rubygems.org/..........
       Fetching rake 13.0.3

〜省略〜

       Installing bootstrap 5.0.1
       Bundle complete! 27 Gemfile dependencies, 102 gems now installed.
       Gems in the groups 'development' and 'test' were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Bundle completed (162.35s)
       Cleaning up the bundler cache.
-----> Installing node-v12.16.2-linux-x64
-----> Installing yarn-v1.22.4
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       yarn install v1.22.4
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.3.2: The platform "linux" is incompatible with this module.
       info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > bootstrap@5.0.1" has unmet peer dependency "@popperjs/core@^2.9.2".
       [4/4] Building fresh packages...
       Done in 23.51s.
       I, [2021-06-02T14:26:05.711596 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
       I, [2021-06-02T14:26:05.711998 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
       I, [2021-06-02T14:26:05.712283 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/akadamakinugasatake-71fb3883dd6034b8c25182024af2570fcee1b197d41f46cfefc1c27cf6a8a291.png
       I, [2021-06-02T14:26:05.713852 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/amigasatake-35f500506e096388078ca5e01fd8a5c77d9b6c2dfde2252ead103b0e1d693882.png
       I, [2021-06-02T14:26:05.714328 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/benitengutake-5ea4ad04569b1041a0795c6d7492cff6bd59da8e23fef0733a2ccc4408802062.png
       I, [2021-06-02T14:26:05.714800 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/kaentake-657e92355edef4df6ff742bf63253b1d75c1b307bce7f9aeb8cbb486e3c97c92.png
       I, [2021-06-02T14:26:05.715509 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/kakishimezi-50878dfc4a10eb4b7060f63145e3ac79f24895829c0aefeb2909b31fec312a7c.png
       I, [2021-06-02T14:26:05.718116 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/kanzoutake-1a95e01d3d1565f363cb6067bb9988997d887d538b21cf1f48082dc0bbcbd3f8.png
       I, [2021-06-02T14:26:05.719638 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/kinoko-e06a2b4e2ae765e65a693926cbe0b822e20d9d4b4e78028250873f4639631191.png
       I, [2021-06-02T14:26:05.721303 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/kusaurabenitake-229be4a8d30c315b6931a6e28f6c39eea81214eda66a5e4f2e544ff686122e8b.png
       I, [2021-06-02T14:26:05.722192 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/sasakurehitoyotake-38fa61cfb566349ebf4948bbe31721c37326aa5531d2e82b783387c73c200eaa.png
       I, [2021-06-02T14:26:05.723958 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/shirotamagotengutake-cc81a8733a62bdd9b030b96a600fb5b4a455d966571d01007ec076358c036c28.png
       I, [2021-06-02T14:26:05.724964 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/tukiyotake-b8a617bf1aeb2ada4fe0d0637580c20f58951030e6bf2945794c5a0d10815c4b.png
       I, [2021-06-02T14:26:05.725653 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/application-46fde15497d4d5e232ff92d0eb558d7b04222e2d34c1e808f5c4a001108f768b.css
       I, [2021-06-02T14:26:05.726128 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/application-46fde15497d4d5e232ff92d0eb558d7b04222e2d34c1e808f5c4a001108f768b.css.gz
       I, [2021-06-02T14:26:05.727558 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/balloon-b98683eaa7c4aa99affca3e3353efd18a77b961b6a87e2f361cd3dd1dac24171.css
       I, [2021-06-02T14:26:05.729402 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/balloon-b98683eaa7c4aa99affca3e3353efd18a77b961b6a87e2f361cd3dd1dac24171.css.gz
       I, [2021-06-02T14:26:05.730227 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/results-a660d06b2b728f702540e3cac59b1eb4633b469c977cf8041bed8a4c9a86d20e.css
       I, [2021-06-02T14:26:05.730953 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/results-a660d06b2b728f702540e3cac59b1eb4633b469c977cf8041bed8a4c9a86d20e.css.gz
       I, [2021-06-02T14:26:05.731212 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/top-3ae5747852a558743cc03d6130525f9e639e7583fc17957dabcb9d68afbf367d.css
       I, [2021-06-02T14:26:05.731401 #1484]  INFO -- : Writing /tmp/build_68105761/public/assets/top-3ae5747852a558743cc03d6130525f9e639e7583fc17957dabcb9d68afbf367d.css.gz
       Compiling...
       Compilation failed:
       ModuleNotFoundError: Module not found: Error: Can't resolve '@popperjs/core' in '/tmp/build_68105761/node_modules/bootstrap/dist/js'
           at /tmp/build_68105761/node_modules/webpack/lib/Compilation.js:925:10
           at /tmp/build_68105761/node_modules/webpack/lib/NormalModuleFactory.js:401:22
           at /tmp/build_68105761/node_modules/webpack/lib/NormalModuleFactory.js:130:21
           at /tmp/build_68105761/node_modules/webpack/lib/NormalModuleFactory.js:224:22
           at /tmp/build_68105761/node_modules/neo-async/async.js:2830:7
           at /tmp/build_68105761/node_modules/neo-async/async.js:6877:13
           at /tmp/build_68105761/node_modules/webpack/lib/NormalModuleFactory.js:214:25
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:213:14
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:41:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
           at /tmp/build_68105761/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
           at _next42 (eval at create (/tmp/build_68105761/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
       resolve '@popperjs/core' in '/tmp/build_68105761/node_modules/bootstrap/dist/js'
         Parsed request is a module
         using description file: /tmp/build_68105761/node_modules/bootstrap/package.json (relative path: ./dist/js)
           Field 'browser' doesn't contain a valid alias configuration
           resolve as module
             looking for modules in /tmp/build_68105761/app/javascript
               using description file: /tmp/build_68105761/package.json (relative path: ./app/javascript)
                 Field 'browser' doesn't contain a valid alias configuration
                 using description file: /tmp/build_68105761/package.json (relative path: ./app/javascript/@popperjs/core)
                   no extension
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core doesn't exist
                   .mjs
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.mjs doesn't exist
                   .js
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.js doesn't exist
                   .sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.sass doesn't exist
                   .scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.scss doesn't exist
                   .css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.css doesn't exist
                   .module.sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.module.sass doesn't exist
                   .module.scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.module.scss doesn't exist
                   .module.css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.module.css doesn't exist
                   .png
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.png doesn't exist
                   .svg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.svg doesn't exist
                   .gif
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.gif doesn't exist
                   .jpeg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.jpeg doesn't exist
                   .jpg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/app/javascript/@popperjs/core.jpg doesn't exist
                   as directory
                     /tmp/build_68105761/app/javascript/@popperjs/core doesn't exist
             /tmp/build_68105761/node_modules/bootstrap/dist/js/node_modules doesn't exist or is not a directory
             /tmp/build_68105761/node_modules/bootstrap/dist/node_modules doesn't exist or is not a directory
             /tmp/build_68105761/node_modules/bootstrap/node_modules doesn't exist or is not a directory
             /tmp/build_68105761/node_modules/node_modules doesn't exist or is not a directory
             /tmp/node_modules doesn't exist or is not a directory
             /node_modules doesn't exist or is not a directory
             looking for modules in /tmp/build_68105761/node_modules
               using description file: /tmp/build_68105761/package.json (relative path: ./node_modules)
                 Field 'browser' doesn't contain a valid alias configuration
                 using description file: /tmp/build_68105761/package.json (relative path: ./node_modules/@popperjs/core)
                   no extension
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core doesn't exist
                   .mjs
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.mjs doesn't exist
                   .js
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.js doesn't exist
                   .sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.sass doesn't exist
                   .scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.scss doesn't exist
                   .css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.css doesn't exist
                   .module.sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.module.sass doesn't exist
                   .module.scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.module.scss doesn't exist
                   .module.css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.module.css doesn't exist
                   .png
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.png doesn't exist
                   .svg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.svg doesn't exist
                   .gif
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.gif doesn't exist
                   .jpeg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.jpeg doesn't exist
                   .jpg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_68105761/node_modules/@popperjs/core.jpg doesn't exist
                   as directory
                     /tmp/build_68105761/node_modules/@popperjs/core doesn't exist
       
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

warning " > bootstrap@5.0.1" has unmet peer dependency "@popperjs/core@^2.9.2".

ModuleNotFoundError: Module not found: Error: Can't resolve '@popperjs/core' in '/tmp/build_68105761/node_modules/bootstrap/dist/js'

から、bootstrap5に依存するpopperjsはpopperjs/coreであるということなので、yarn add @poppserjs/coreした。

成功!

< Ruby > 最新のバージョンを入れる

現在rbenv内にインストールされているバージョンを確認

$ rbenv versions

homebrewのrbenvをアップグレードする。

$ brew upgrade rbenv-build

アップグレードしたrbenvからインストールできるバージョンを確認

$ rbenv install -l

2021.6.2現在のrubyの安定版は3.0.1なので、今回はそれをインストール

$ rbenv install 3.0.1

パソコン全体で切り替え

$ rbenv global 3.0.1

アプリ内で切り替え

$ rbenv local 3.0.1

参考

www.ruby-lang.org

< git > git logを見やすくする設定

$ git log --graph --all --format="%x09%C(green)%an%Creset%x09%C(yellow)%h%Creset %C(red bold)%d%Creset %s"

を実行すると、以下のようになる。 Image from Gyazo (左側はuser_name)


エイリアス登録すれば、手軽に確認できる。

参考

git log を見やすくする - Qiita

<Ruby on Rails エラー編> PG::DuplicateTable: ERROR: relation "tweets" already exists

発生したエラー

rails db:migrateを実行すると以下のエラーが発生した。

rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "tweets" already exists
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.3.2/lib/patches/db/pg.rb:110:in `exec'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.3.2/lib/patches/db/pg.rb:110:in `async_exec'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:322:in `create_table'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:929:in `block in method_missing'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:897:in `block in say_with_time'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:897:in `say_with_time'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:918:in `method_missing'
/Users/user_name/workspace/runteq/PF/kinoko2/db/migrate/20210514015843_create_tweets.rb:3:in `change'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:867:in `exec_migration'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:850:in `block in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:849:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1037:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:310:in `block in within_new_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:308:in `within_new_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/transactions.rb:209:in `transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1380:in `ddl_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1302:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1251:in `block in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1251:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1086:in `up'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1061:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:90:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/rake_module.rb:59:in `with_application'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/command.rb:52:in `invoke'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/rails:5:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `block in <top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `tap'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `<top (required)>'

Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "tweets" already exists
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.3.2/lib/patches/db/pg.rb:110:in `exec'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.3.2/lib/patches/db/pg.rb:110:in `async_exec'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:322:in `create_table'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:929:in `block in method_missing'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:897:in `block in say_with_time'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:897:in `say_with_time'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:918:in `method_missing'
/Users/user_name/workspace/runteq/PF/kinoko2/db/migrate/20210514015843_create_tweets.rb:3:in `change'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:867:in `exec_migration'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:850:in `block in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:849:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1037:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:310:in `block in within_new_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:308:in `within_new_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/transactions.rb:209:in `transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1380:in `ddl_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1302:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1251:in `block in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1251:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1086:in `up'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1061:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:90:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/rake_module.rb:59:in `with_application'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/command.rb:52:in `invoke'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/rails:5:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `block in <top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `tap'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `<top (required)>'

Caused by:
PG::DuplicateTable: ERROR:  relation "tweets" already exists
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.3.2/lib/patches/db/pg.rb:110:in `exec'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.3.2/lib/patches/db/pg.rb:110:in `async_exec'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:322:in `create_table'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:929:in `block in method_missing'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:897:in `block in say_with_time'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:897:in `say_with_time'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:918:in `method_missing'
/Users/user_name/workspace/runteq/PF/kinoko2/db/migrate/20210514015843_create_tweets.rb:3:in `change'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:867:in `exec_migration'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:850:in `block in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:849:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1037:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:310:in `block in within_new_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:308:in `within_new_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/transactions.rb:209:in `transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1380:in `ddl_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1302:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1251:in `block in migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1251:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1086:in `up'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:1061:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:90:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/rake_module.rb:59:in `with_application'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/command.rb:52:in `invoke'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/rails:5:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `require'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `block in <top (required)>'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `tap'
/Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

対処法

PG::DuplicateTable: ERROR: relation "tweets" already existsという記載から、tweetsというテーブルが既に存在していることがわかる。
原因はデータベースにテーブルが消したテーブルが残っていたのが原因。

$ rails db:migrate:reset

Dropped database 'kinoko2_test'
Created database 'kinoko2_development'
Created database 'kinoko2_test'
== 20210514015843 CreateTweets: migrating =====================================
-- create_table(:tweets)
   -> 0.0352s
== 20210514015843 CreateTweets: migrated (0.0353s) ============================

を実行することでデータベースをdropされ、新たにテーブルがcreateされる。
これによりDBがリセットされて、rails db:migrateすることでエラーが解消される。

参考文献

[Rails5] PG::DuplicateTable: ERROR~の解決方法 | kirohi.com

<VSC> ショートカットキーについて

ショートカットキーの一覧を開く

⌘ + k + s

よく使う

ターミナル->エディタへ移動

⌘ + 1 (規定)

エディタ->ターミナルへ移動

⌘ + y (ユーザー設定)

指定ファイルを開く

⌘ + p (規定)

現在開いているファイルを上書き保存

⌘ + s (規定)

現在開いているファイルを閉じる

⌘ + w (規定)
※ファイルが開いてない場合はVSCを閉じる

ファイルを移動

右:⌘ + shift + ] (規定)
左:⌘ + shift + [ (規定)

パネルを閉じる

⌘ + j (規定)

参考文献

Visual Studio Code でエディタとターミナルを移動するショートカットキーの作成 - Qiita

<Ruby on Rails エラー編> mimemagicのbundle installエラーについて

エラーについて

mimemagicがbundle installできなくなった。
2021年3月下旬、twitterなどで大騒ぎになった。
大元が誤ったライセンスのもと配布していたようで、MITで配布していたが、実際はmimemagicの中のファイルがshared-mime-infoに依存しているためライセンスはGPLということになって修正が入り、ActiveRecordがmimemagicに依存していたため、buildができない大混乱が生じた、ということらしい?
数日後該当のファイルを削除してMITに戻ったらしいが、その代わりGPLのshared-mime-infoのインストールを自分で行わないといけなくなったということらしい。
Rails 5.2.5, 6.0.3.6, 6.1.3.1に関してはmimemagicの依存がなくなったとのことで、問題はなくなったよう。

対処法

Rails 5.2.5以前のものはmimemagicが依存しているため、別途shared-mime-infoをインストールする必要がある。

$ brew install shared-mime-info

参考文献

ruby on rails - docker build error Gem::Ext::BuildError: ERROR: Failed to build gem native extension for mimemagic-0.3.9 - Stack Overflow

Rails waves goodbye to mimemagic, welcomes Marcel to fix GPL MIME drama • The Register

週刊Railsウォッチ(20210329前編)特集: Rails更新版の臨時リリースとmimemagic gemのGPL問題|TechRacho(テックラッチョ)〜エンジニアの「?」を「!」に〜|BPS株式会社

mimemagicの最新動向 - HackMD

https://wa3.i-3-i.info/word13200.html

RailsのGPL混入問題についてまとめ(mimemagic) - Qiita

<Ruby on Rails エラー編> rails consoleが起動できない

発生したエラー

rails consoleを実行すると、以下のエラーが発生した。

Traceback (most recent call last):
        17: from bin/rails:2:in `<main>'
        16: from bin/rails:2:in `load'
        15: from /Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `<top (required)>'
        14: from /Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:7:in `tap'
        13: from /Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `block in <top (required)>'
        12: from /Users/user_name/workspace/runteq/PF/kinoko2/bin/spring:10:in `require'
        11: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        10: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
         9: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
         8: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
         7: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
         6: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:24:in `call'
         5: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
         4: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/run.rb:35:in `call'
         3: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/run.rb:42:in `warm_run'
         2: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/run.rb:62:in `run'
         1: from /Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/run.rb:117:in `verify_server_version'
/Users/user_name/workspace/runteq/PF/kinoko2/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/run.rb:117:in `gets': Interrupt

対処

デフォルトでセットされているSpringは、アプリケーションをバックグラウンドで動作させることで、開発を高速化するgem。
見たところspringが動いているので、プロセスを確認。

$ ps aux | grep -i spring
user_name            5264   0.0  0.0  4387048   2056   ??  S     4:11PM   0:01.33 spring server | kinoko2 | started 11 hours ago   
user_name           32697   0.0  0.0  4279688    764 s002  S+    4:50AM   0:00.01 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox -i spring

springをkillする。

$ kill -9 5264 

rails consoleを実行したところ、動いた。

参考文献

railsのコマンドが動かない時はspringを(stop|kill)してみよう - Qiita

<Ruby on Rails エラー編> PostgreSQLに接続できなかった時の対処法

エラー詳細

create db:createを実行しようとするとエラーが出た。

could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Couldn't create 'アプリ名_development' database. Please check your configuration.
rails aborted!
ActiveRecord::ConnectionNotEstablished: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:283:in `connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/postgresql_database_tasks.rb:26:in `create'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:133:in `create'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:193:in `block in create_current'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:506:in `block (2 levels) in each_current_configuration'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:503:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:503:in `block in each_current_configuration'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:502:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:502:in `each_current_configuration'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:193:in `create_current'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:45:in `block (2 levels) in <main>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/rake_module.rb:59:in `with_application'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/command.rb:52:in `invoke'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/rails:5:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/spring:10:in `block in <top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/spring:7:in `tap'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/spring:7:in `<top (required)>'

Caused by:
PG::ConnectionBad: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:283:in `connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/postgresql_database_tasks.rb:26:in `create'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:133:in `create'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:193:in `block in create_current'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:506:in `block (2 levels) in each_current_configuration'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:503:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:503:in `block in each_current_configuration'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:502:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:502:in `each_current_configuration'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/tasks/database_tasks.rb:193:in `create_current'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.3.2/lib/active_record/railties/databases.rake:45:in `block (2 levels) in <main>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/rake-13.0.3/lib/rake/rake_module.rb:59:in `with_application'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/command.rb:52:in `invoke'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/rails:5:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/user_name/workspace/runteq/PF/アプリ名/vendor/bundle/ruby/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/spring:10:in `block in <top (required)>'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/spring:7:in `tap'
/Users/user_name/workspace/runteq/PF/アプリ名/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

やったこと

まず、postgreSQLが動作しているかを確認する。

$ brew services list
mysql@5.7  stopped        
postgresql error   user_name /Users/user_name/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

エラーが発生していて、起動できていないことが確認できた。
一応upgradeを一度して、改めてパスを通した。

$ brew upgrade postgresql

$ echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
$ source ~/.zshrc 

upgradeした時にpostgresqlの起動方法が表示されているので、

To have launchd start postgresql now and restart at login: 
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start

のうち、

$ pg_ctl -D /usr/local/var/postgres start 

起動を実行した。

waiting for server to start....2021-05-13 00:13:14.089 JST [24927] LOG:  starting PostgreSQL 13.2 on x86_64-apple-darwin20.3.0, compiled by Apple clang version 12.0.0 (clang-1200.0.32.29), 64-bit
2021-05-13 00:13:14.091 JST [24927] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2021-05-13 00:13:14.091 JST [24927] LOG:  listening on IPv6 address "::1", port 5432
2021-05-13 00:13:14.107 JST [24927] FATAL:  could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied
2021-05-13 00:13:14.109 JST [24927] LOG:  database system is shut down
 stopped waiting
pg_ctl: could not start server
Examine the log output.

すると上記のような表示が出力され、tmpディレクトリにpermission deniedが発生していることがわかった。
そのため、以下のコマンドで許可を与えた。

$ sudo chmod 1777 /tmp 

そしてもう一度

$ pg_ctl -D /usr/local/var/postgres start 

を実行した。
すると以下のような表示が出た。

pg_ctl: another server might be running; trying to start server anyway
waiting for server to start....2021-05-13 00:17:46.861 JST [25470] FATAL:  lock file "postmaster.pid" already exists
2021-05-13 00:17:46.861 JST [25470] HINT:  Is another postmaster (PID 25460) running in data directory "/usr/local/var/postgres"?
 stopped waiting
pg_ctl: could not start server
Examine the log output.

今度はlock file "postmaster.pid" already existsという表示が出たのでrmした。

$ rm /usr/local/var/postgres/postmaster.pid 

brew services listで動作確認をまた行うと、

Name       Status  User   Plist
mysql@5.7  stopped        
postgresql started user_name /Users/user_name/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

で動作確認ができ、rails db:createも実行できるようになった。

参考文献

Postgresqlに接続できなくなった時の対処法 - Qiita

<Ruby on Rails> credentials.yml.encの設定方法

credentialsとは

production環境用の秘密情報の管理をするためにRails5.2でcredentialsという機能が追加された。
これが導入されるまでは環境変数などで設定されていた。
credentialsは、管理される秘密情報そのものを指すと同時に、管理の仕組みを指す言葉である。
この仕組みを簡単に説明すると、credentials.yml.encファイルに記載された情報を暗号化し、master.keyで複合し、使用できるようにしたもの。

credentials.yml.enc

秘密情報(credentials)は、config/credentials.yml.encに記述する。
このファイルは常に暗号化して保存され、このファイルの内容を編集するには専用コマンドを使用する。
複合はmaster.keyファイルなどからキー情報を取り出して行われる。

Image from Gyazo ※1のp280を参照

基本的に同一のリポジトリにcredentialsファイルとmaster.keyファイルを一緒に置かないこと(復号できてしまうので)。
Railsアプリケーションは、.gitignoreに最初からconfig/master.keyが記述されており、pushされないようになっている。


中身を見るコマンド

$ bin/rails credentials:show


編集するコマンド

$ bin/rails credentials:edit

EDITOR環境変数が設定されていないと、以下のような記載が必要になる。
例:vimの場合

$ EDITOR=vi bin/rails credentials:edit

ちなみにEDITOR環境変数は以下のように設定できる。

$ echo 'export EDITOR=vi' >> ~/.zshrc  // 環境変数EDITORを設定
$ source ~/.zshrc  // 環境設定ファイル~/.zshrcの内容を反映させる


アプリケーションからcredentialsを参照

例:デフォルトのAWSを参照する

$ Rails.application.credentials.aws
=> {:access_key_id=>123, :secret_access_key=>345}

$ Rails.application.credentials.aws[:access_key_id]
=>123

$ Rails.application.credentials.aws[:secret_access_key]
=>345

参考文献

Rails5.2から追加された credentials.yml.enc のキホン - Qiita

現場で使える Ruby on Rails 5速習実践ガイド | 大場寧子, 松本拓也, 櫻井達生, 小田井優, 大塚隆弘, 依光奏江, 銭神裕宜, 小芝美由紀 |本 | 通販 | Amazon※1

Linux編集エディタの変更 - 環境変数EDITORの設定 - Linux入門 - Webkaru

【 source 】コマンド/【 . 】コマンド――シェルの設定を即座に反映させる:Linux基本コマンドTips(169) - @IT