I did a little check to see if one needs to add the Node buildpack directly for a React on Rails app. One might guess that since webpacker is a default, then you wouldn’t need to do this.
It seems that the answer is still yes.
heroku buildpacks:set heroku/ruby heroku buildpacks:add --index 1 heroku/nodejs
If you don’t do that, you might get some error like this:
git push heroku [15:17:35] Enumerating objects: 196, done. Counting objects: 100% (196/196), done. Delta compression using up to 16 threads Compressing objects: 100% (171/171), done. Writing objects: 100% (196/196), 165.94 KiB | 6.38 MiB/s, done. Total 196 (delta 65), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. remote: Detected buildpacks: Ruby,Node.js remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
and then later in the build log:
remote: Running: rake assets:precompile remote: yarn install v1.16.0 remote: warning package.json: No license field remote: warning No license field remote: [1/5] Validating package.json... remote: warning No license field remote: error @: The engine "node" is incompatible with this module. Expected version "13.9.0". Got "10.15.3" remote: error @: The engine "yarn" is incompatible with this module. Expected version "1.22.4". Got "1.16.0" remote: error Found incompatible module. remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. remote: Compiling... remote: Compilation failed: remote: yarn run v1.16.0 remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. remote: remote: remote: warning package.json: No license field remote: warning package.json: No license field remote: error Command "webpack" not found. remote: 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 test-only-ruby-buildpack. remote: To https://git.heroku.com/test-only-ruby-buildpack.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/test-only-ruby-buildpack.git'