Hi, as I was deploying rails app on App Platform, I was getting error as followed. Since yarn is already included when I have webpacker gem in the project Gemfile, however, I suspect
yarn install was not executed before the out-of-box
rake assets:precompile command. So, I’m getting the file not found due to no node_modules being installed.
Cleaning up the bundler cache. truscan-demo | 21:33:34 -----> Installing node-v12.16.2-linux-x64 truscan-demo | 21:33:39 -----> Installing yarn-v1.22.4 truscan-demo | 21:33:40 -----> Detecting rake tasks truscan-demo | 21:34:00 -----> Preparing app for Rails asset pipeline truscan-demo | 21:34:00 Running: rake assets:precompile truscan-demo | 21:34:23 cd "/workspace" && RAILS_ENV=production bin/webpack truscan-demo | 21:34:26 /layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/gems/webpacker-3.6.0/lib/webpacker/webpack_runner.rb:11:in `exec': No such file or directory - /workspace/node_modules/.bin/webpack (Errno::ENOENT) truscan-demo | 21:34:26 from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/gems/webpacker-3.6.0/lib/webpacker/webpack_runner.rb:11:in `block in run' truscan-demo | 21:34:26 from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/gems/webpacker-3.6.0/lib/webpacker/webpack_runner.rb:10:in `chdir' truscan-demo | 21:34:26 from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/gems/webpacker-3.6.0/lib/webpacker/webpack_runner.rb:10:in `run' truscan-demo | 21:34:26 from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/gems/webpacker-3.6.0/lib/webpacker/runner.rb:6:in `run' truscan-demo | 21:34:26 from bin/webpack:15:in `<main>' truscan-demo | 21:34:26 rake aborted! truscan-demo | 21:34:26 Command failed with status (1): [cd "/workspace" && RAILS_ENV=production bi...] truscan-demo | 21:34:26 /layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/gems/react_on_rails-11.1.8/lib/tasks/assets.rake:64:in `block (3 levels) in <top (required)>' truscan-demo | 21:34:26 Tasks: TOP => assets:precompile => react_on_rails:assets:compile_environment => react_on_rails:assets:webpack truscan-demo | 21:34:26 (See full trace by running task with --trace) truscan-demo | 21:34:26 truscan-demo | 21:34:26 ! truscan-demo | 21:34:26 ! Precompiling assets failed.
Note that I have
yarn install as build command already. Perhaps it is to run after
rake assets:precompeile, but I need it before this rake task. Please help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!