Oba-eng / curry_web

0 stars 0 forks source link

デプロイができない  #26

Open Oba-eng opened 7 months ago

Oba-eng commented 7 months ago
oobarikuto@MacBook-Air-2 carry_web % git push heroku main
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to curry-tree.
remote: 
To https://git.heroku.com/curry-tree.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/curry-tree.git'

すごく長いのでエラーの部分だけ切り取ってます。

config/inviroment/production.rb config.assets.js_compressor = Uglifier.new(harmony: true) このコードを追加することでE6構文を使えるようにしました。

kenchasonakai commented 7 months ago

似たようなことが起きている人がいると思うのでまずは記事を探してみましょう エラーを全文貼ったらご自身の環境にしか関係の無い情報が混ざってしまって検索結果に出てこないとかがあると思うのでログをよく読んで関係のありそうなところの他の人にも共通の部分を切り出して検索したり、エラー文ではなくHerokuでデプロイが出来ないという現象でいろいろ検索してみましょう

Oba-eng commented 7 months ago

https://www.notion.so/MVP-c1d4d3457d9a494bbfd04ef758a7e7b7 ↑いつも使っているメモです。

エラーに関係ありそうな部分からググってみたりチャットGPTに聞いてみたりと試してみましたが同じようなエラーがぐるぐる回っているためどうしてもエラー解消できなさそうです。仮説を立て検証をしようとしてもそもそもエラーの原因が何か情報がないため仮説を立てられません。なんとなくこれかな?といった勘を頼りに進めてみましたがダメでした。

現状2つ問題があります。

remote:        ERROR in ./app/javascript/packs/application.js
remote:        Module build failed (from ./node_modules/babel-loader/lib/index.js):
remote:        Error: Cannot find package '@babel/plugin-proposal-private-methods' imported from /tmp/build_7120d00a/babel-virtual-resolve-base.js

とあるので@babel/plugin-proposal-private-methodsが見つけられないと返ってきてますが、インストールはされており babel.config.jsの設定も正しいことが確認できました。

remote:        Entrypoint application = js/application-aaba6ca568d04800668a.js js/application-aaba6ca568d04800668a.js.map
remote:        Entrypoint menus = js/menus-b27418d2214e223dfaab.js js/menus-b27418d2214e223dfaab.js.map
remote:        [0] ./app/javascript/packs/application.js 4.43 KiB {0} [built] [failed] [1 error]
remote:        [1] ./app/javascript/packs/menus.js 4.43 KiB {1} [built] [failed] [1 error]

また上記のログではエントリーポイントに関する内容が書かれてますがこれもwebpack.config.jsの設定を変更しましたが 同じログが返ってくるため次にやれることがないです。

もう調べようがないと感じたらどこを見て進めたらいいのでしょうか? 抽象的な質問ですいません。

Oba-eng commented 7 months ago
remote: -----> Installing node-v20.9.0-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        D, [2024-04-09T21:57:56.397219 #430] DEBUG -- : [dotenv] Set MAILER_ADDRESS and MAILER_PASSWORD
remote:        I, [2024-04-09T21:57:56.397291 #430]  INFO -- : [dotenv] Loaded .env
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        rake aborted!
remote:        Sprockets::FileNotFound: couldn't find file 'jquery' with type 'application/javascript'
remote:        Checked in these paths: 
remote:          /tmp/build_ebaa66ea/app/assets/config
remote:          /tmp/build_ebaa66ea/app/assets/images
remote:          /tmp/build_ebaa66ea/app/assets/javascripts
remote:          /tmp/build_ebaa66ea/app/assets/stylesheets
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/coffee-rails-4.2.2/lib/assets/javascripts
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/actioncable-6.1.4/app/assets/javascripts
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/activestorage-6.1.4/app/assets/javascripts
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/actionview-6.1.4/lib/assets/compiled
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/turbolinks-source-5.2.0/lib/assets/javascripts
remote:          /tmp/build_ebaa66ea/node_modules
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/popper_js-2.11.8/assets/javascripts
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/bootstrap-5.3.2/assets/stylesheets
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/bootstrap-5.3.2/assets/javascripts
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/font-awesome-sass-5.15.1/assets/stylesheets
remote:          /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/font-awesome-sass-5.15.1/assets/fonts
remote:        /tmp/build_ebaa66ea/app/assets/javascripts/application.js:14
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/resolve.rb:65:in `resolve!'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:399:in `resolve'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:207:in `process_require_directive'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:180:in `block in process_directives'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in `each'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in `process_directives'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:83:in `_call'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:68:in `call'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_ebaa66ea/vendor/bundle/ruby/3.0.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to curry-tree.
remote: 
To https://git.heroku.com/curry-tree.git
 ! [remote rejected] MVPリリース -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/curry-tree.git'

プルリクエストの内容を反映させてどうなるかを確認してましたがずっとエラーが続いてます。 jQueryが見当たらないとログでは言ってますが、application.jsには

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
//= require jquery
//= require activestorage
//= require turbolinks
//= require bootstrap
//= require_tree .

と設定をしてあるのでどうして読み込みがされないのか分からないです。

Oba-eng commented 7 months ago

Image from Gyazo

Gemlock.fileの最後の箇所だけずっと左に青い線が入っておりコミットをしてもこれが消えません。