STUDY MEMO

学習のメモ書き

<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