LoginSignup
10
7

More than 5 years have passed since last update.

Railsでwebpackerを入れるとherokuへのデプロイでこける時の対処法

Last updated at Posted at 2018-02-27

環境

  • Rails 5.1.5
  • webpack 3.11.0

エラーメッセージ

remote:        Webpacker is installed 🎉 🍰
remote:        Using /tmp/build_a60546bb726d2fa7f4b8b4ac052f461e/config/webpacker.yml file for setting up webpack paths
remote:        Compiling…
remote:        Compilation failed:
remote:        bundler: failed to load command: webpack (/tmp/build_a60546bb726d2fa7f4b8b4ac052f461e/vendor/bundle/ruby/2.3.0/bin/webpack)
remote:        Errno::ENOENT: No such file or directory - /tmp/build_a60546bb726d2fa7f4b8b4ac052f461e/node_modules/.bin/webpack

対策

heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add heroku/ruby

原因

heroku buildpacksのデフォルトのnode関連のエンジンのバージョンが古いためのようです。

参考

https://github.com/rails/webpacker/issues/739
https://github.com/rails/webpacker/issues/1282
https://github.com/heroku/heroku-buildpack-ruby/issues/712
https://qiita.com/tatsuyankmura/items/728e190b92e0370eefbb

10
7
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7