Skip to content

Can't properly compile assets on heroku? #1164

@dben89x

Description

@dben89x

I've tried to build this dozens of times on production using react_on_rails, but keep getting the following error:

Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       ReactOnRails: Set generated_assets_dir to default: public/webpack/production
       cd /tmp/build_f34d4e61a9f55dec692297dd2593a818 && RAILS_ENV=production bin/webpack
       /tmp/build_f34d4e61a9f55dec692297dd2593a818/vendor/bundle/ruby/2.4.0/gems/webpacker-3.2.0/lib/webpacker/webpack_runner.rb:11:in `exec': No such file or directory - /tmp/build_f34d4e61a9f55dec692297dd2593a818/node_modules/.bin/webpack (Errno::ENOENT)
       from /tmp/build_f34d4e61a9f55dec692297dd2593a818/vendor/bundle/ruby/2.4.0/gems/webpacker-3.2.0/lib/webpacker/webpack_runner.rb:11:in `block in run'
       from /tmp/build_f34d4e61a9f55dec692297dd2593a818/vendor/bundle/ruby/2.4.0/gems/webpacker-3.2.0/lib/webpacker/webpack_runner.rb:10:in `chdir'
       from /tmp/build_f34d4e61a9f55dec692297dd2593a818/vendor/bundle/ruby/2.4.0/gems/webpacker-3.2.0/lib/webpacker/webpack_runner.rb:10:in `run'
       from /tmp/build_f34d4e61a9f55dec692297dd2593a818/vendor/bundle/ruby/2.4.0/gems/webpacker-3.2.0/lib/webpacker/runner.rb:6:in `run'
       from /tmp/build_f34d4e61a9f55dec692297dd2593a818/vendor/bundle/ruby/2.4.0/gems/webpacker-3.2.0/exe/webpack:8:in `<top (required)>'

I've come across #727 and #739, but still having issues. I've tried deploying via Travis CI, and running yarn install during the build.

My heroku buildpacks are:

1. heroku/ruby
2. heroku/nodejs

I've ensured the following by running heroku run bash in my environment:

  • Heroku is using yarn v 1.0.2.
  • ~/node_modules/.bin/webpack exists.

If I manually run rake webpacker:compile via heroku's command line, it says it successfully gives me this:

Webpacker is installed 🎉 🍰
Using /app/config/webpacker.yml file for setting up webpack paths
ReactOnRails: Set generated_assets_dir to default: public/webpack/production
Compiling…
Compiled all packs in /app/public/packs

At which point I can see all the packs I need in ~/public/packs.

I've been racking my brain over this for days and not too sure what else to try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions