Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Ruby / Rails Cache Webpack + Yarn Between Deploys

I currently have a brand new ruby / rails app setup with webpacker. Every deploy to Heroku takes an additional 30+ seconds to re-install the yarn dependencies (runs yarn install).

remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        info [email protected]: The platform "linux" is incompatible with this module.
remote:        info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "[email protected]" has incorrect peer dependency "babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@2 || 3".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^3.1.0".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "caniuse-lite@^1.0.30000697".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "node-sass@^4.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "file-loader@*".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@1 || 2 || 3".
remote:        warning "[email protected]" has incorrect peer dependency "ajv@^5.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "babel-helper-vue-jsx-merge-props@^2.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "babel-plugin-syntax-jsx@^6.8.0".
remote:        warning "[email protected]" has incorrect peer dependency "css-loader@*".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^2.2.0 || ^3.0.0".
remote:        warning "[email protected]" has incorrect peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
remote:        [4/4] Building fresh packages...
remote:        Done in 33.50s.
remote:        Webpacker is installed 🎉 🍰

I'm currently using the heroku/ruby buildpack on the heroku-16 stack. Any easy way to get the caching to work like it does for bundler?

like image 556
Stussa Avatar asked Dec 21 '17 19:12

Stussa


People also ask

Can I deploy my first rails 6 application to Heroku?

You have deployed your first Rails 6 application to Heroku. Here’s some recommended reading: Visit the Ruby support category to learn more about using Ruby and Rails on Heroku.

What is Ruby on rails 6 on Heroku?

Ruby on Rails is a popular web framework written in Ruby. This guide covers using Rails 6 on Heroku. For information on running previous versions of Rails on Heroku, see the tutorial for Rails 5.x or Rails 4.x. For this guide you will need:

How do I deploy a Heroku project using Git?

Heroku relies on Git, a distributed source control management tool, for deploying your project. If your project is not already in Git, first verify that git is on your system: If you don’t see any output or get command not found you need to install Git on your system.

How do I view information about my running app on Heroku?

You can view information about your running app using one of the logging commands, heroku logs: You can also get the full stream of logs by running the logs command with the --tail flag option like this: By default, new applications are deployed to a free dyno. Free apps will “sleep” to conserve resources.


1 Answers

Maybe you can add a second nodejs buildpack in addition to your heroku stack:

heroku buildpacks:add --index 1 heroku/nodejs

The nodejs buildpack should support yarn caching as described here.

like image 141
smallbutton Avatar answered Oct 12 '22 01:10

smallbutton