febeling / webpack-rails-buildpack Goto Github PK
View Code? Open in Web Editor NEWBuildpack for webpack-rails
License: MIT License
Buildpack for webpack-rails
License: MIT License
Hi, I'm trying install using your instructions webpack-rails-buildpack
and receiving the error the last pat of it I want to share with you
...
remote: -----> bundle exec rake webpack:compile
remote: ** Invoke webpack:compile (first_time)
remote: ** Invoke environment (first_time)
remote: ** Execute environment
remote: ** Execute webpack:compile
remote: rake aborted!
remote: Can't find our webpack config file at /tmp/build_bf4a14785e9ae6614cc312a0e773388c/config/webpack.config.js
remote: /tmp/build_bf4a14785e9ae6614cc312a0e773388c/vendor/bundle/ruby/2.2.0/gems/webpack-rails-0.9.11/lib/tasks/webpack.rake:14:in `block (2 levels) in <top (required)>'
...
What was done wrong and how I can fix it?
Issue #19 pinned the bundler version on a specific one, to get around incompatibility with version 2, which was released today. We should change the version spec from specific to one that can float up to anything below 2.
FYI, the explicit call to gem install bundler
(introduced in #2) started causing build failures for us this morning as a result of Bundler releasing 2.0, which effectively has a breaking change in needing RubyGems 3.0:
-----> webpack-rails app detected
-----> gem install bundler
ERROR: Error installing bundler:
The last version of bundler (>= 0) to support your Ruby & RubyGems was 1.17.3. Try installing it with `gem install bundler -v 1.17.3`
bundler requires RubyGems version >= 3.0.0. The current RubyGems version is 2.7.6. Try 'gem update --system' to update RubyGems itself.
! Push rejected, failed to compile webpack-rails app.
! Push failed
I believe a short-term fix for this would be to forcibly set the version to 1.x in the gem install command. I expect this will go away when Heroku formally supports Bundler 2.0/RubyGems 3.0 in the ruby buildpack.
I'm using ruby 2.6.1 and bundler 2.0.1 for my ruby app.
When I was trying to deploy app I got the following error:
remote: -----> webpack-rails app detected
remote: -----> gem install bundler
remote: ERROR: Error installing bundler:
remote: "bundle" from bundler conflicts with /tmp/build_5f23e64fd8050f5654d8fe6ab7e0bd8d/vendor/ruby-2.6.1/bin/bundle
remote: ! Push rejected, failed to compile webpack-rails app.
remote:
remote: ! Push failed
Is there any workaround to this issue?
There is an edge case where a page loads at the same time as the deploy switches from old to new dynos. The page contains references (e.g. <script>
) to out-of-date assets from the previous deploy, but the client does not have time to download them before the dynos are switched.
The new dyno then does not contain these old assets and would therefore 404. The new dyno only contains assets from the new build. This could only happen in a very short window, however it could be exaggerated by slow/flaky connections.
If the previous deploy's output assets could be pulled from cache and persisted into the new dyno, the problem would be fixed. Note that it would be sensible to restrict this to only the last deploy's output, otherwise the cache may become bloated.
Unfortunately the buildpack doesn't know where the output assets be put, and thus can't move it into the cache. The only options that I could think of to resolve this would be to assume the use of an environment variable or to somehow introspect webpack itself to find the output directory. Do you think either of these are options that you would accept a PR for?
On thursday we started receiving this issue during the slug compilation on heroku.
** Execute webpack:compile
rake aborted!
Can't find our webpack executable at /tmp/build_8f0a62a90132b53a9b4b0536055c0a88/node_modules/.bin/webpack - have you run npm install?
Are there any issues you were aware of. Heroku are saying its an issue with the build pack and not heroku.
These are our current build packs:
As mentioned these were working but are not now.
Reported by @daidekman at c6df2a5#commitcomment-33998456
Rubies < 2.6 come without bundler, but can have a shim.
The test in bin/compile is incorrect, as it relies on file presence, where it really should rely on presence of the gem.
I added this buildpack:
=== app-staging Buildpack URLs
1. heroku/nodejs
2. heroku/ruby
3. https://github.com/febeling/webpack-rails-buildpack.git
When I deploy, I get an error related to using bundle exec
remote: -----> Fetching set buildpack https://github.com/febeling/webpack-rails-buildpack.git... done
remote: -----> webpack-rails app detected
remote: -----> bundle exec rake webpack:compile
remote: /tmp/build_e79d1dc4352be15c4a65c94ee432b514/vendor/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 9 total gem(s) (Gem::LoadError)
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/1.9.1:/tmp/build_e79d1dc4352be15c4a65c94ee432b514/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0', execute `gem env` for more information
remote: from /tmp/build_e79d1dc4352be15c4a65c94ee432b514/vendor/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
remote: from /tmp/build_e79d1dc4352be15c4a65c94ee432b514/vendor/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
remote: from /tmp/build_e79d1dc4352be15c4a65c94ee432b514/vendor/bundle/ruby/2.2.0/bin/bundle:22:in `<main>'
remote:
remote: ! Push rejected, failed to compile webpack-rails app
remote:
Any ideas?
If there is an error in the webpack compile (for example if webpack is misconfigured), then the webpack:compile
rake task aborts but does not fail the deploy.
I believe this can be done by setting the errexit
flag in bash. This is done by the official nodejs buildpack: https://github.com/heroku/heroku-buildpack-nodejs/blob/047dbbf1dcbd83d719b5394dabc5fcd7dc316ff6/bin/compile#L6
There is an error when deploying to Heroku: Can't find our webpack executable at...
, and it asks if npm install
was run.
It looks like this buildpack is hardcoded to use NPM instead of Yarn. We ran into a problem where Yarn was installing and respecting it's lockfile, but then NPM was coming through and installing without a lockfile, thereby overwriting some locked versions.
For the moment we just forked and removed the NPM install line. What would be the best course of action for detecting whether to use Yarn or NPM?
I'm not sure if this is a problem with the heroku nodejs buildpack or with this project, but I figured I would start here. I'm attempting to use the webpack-rails gem (https://github.com/mipearson/webpack-rails) with an app hosted on github. The author links to this project as a way to include the running webpack server that's required for the gem in heroku. I have added the required buildpacks to my app and I have both a Gemfile and a package.json file in the root of my project directory, but heroku returns an error when I attempt to push to it (see gist for proof). I read the source for the official nodejs buildpack, and the detect script seems to be very simple. I tried forking the repo and adding some debugging, but heroku appears to swallow all output from the detect script. Is there another way to figure out what's going on?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.