ぎんさんマインド

いちエンジニアの思考とか趣味についてつらつらと書いてみるかもしれない。

rails5.2 + webpacker3.5(webpack4.28) でherokuにデプロイしようとしてエラー返された

qiita.com

この辺を参考にしつつ

webpack入れてherokuにデプロイしようとした時に

 

$ git push heroku master

remote: Running: rake assets:precompile
remote: yarn install v1.12.3
remote: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised notto mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents@1.2.4: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: [4/4] Building fresh packages...
remote: Done in 36.47s.
remote: rake aborted!
remote: Sprockets::ArgumentError: link_tree argument must be a directory
remote: /tmp/build_***/app/assets/config/manifest.js:2

 

とエラーでてデプロイできなかった。

 

エラー

$ RAILS_ENV=production bundle exec rails assets:precompile

yarn install v1.12.3
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix packagemanagers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
✨ Done in 5.65s.
rails aborted!
Sprockets::ArgumentError: link_tree argument must be a directory

remote: /tmp/build_***/app/assets/config/manifest.js:2

 

ちなmanifest.jsは

//= link_tree ../images
//= link_tree ../javascripts. es6
//= link_tree ../javascripts. js
//= link_directory ../stylesheets. scss

別段特別な変更は加えてない(scssにはしたけど)

 

エラー返されてるのがassetsの方だけれど、webpack入れてるからいらないよなーと思いassetsのファイル全部削除、ついでにwebpack入れた時にデフォルトでできるjavascriptファイルをfrontendに修正した。

そしたらうまくいった。

 

エラーの内容とか理由がよくわからんが、もうちょい使い慣れてきたらわかるようになるかな?