Webpacker: Compilation failed: error Command "webpack" not found - heroku

Ever since I upgraded to rails 6 and installed webpacker I've been getting this message in production:
2019-10-06T10:57:14.221369+00:00 app[web.1]: E, [2019-10-06T10:57:14.221154 #4] ERROR -- : [5e6a4fed-5c09-44fa-a840-24badc9f6a99] [Webpacker] Compilation failed:
2019-10-06T10:57:14.221389+00:00 app[web.1]: error Command "webpack" not found.
There are no further details and it appears that all my js is working fine.
Any ideas?

Try
heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 2 heroku/ruby
Per
https://github.com/rails/webpacker/issues/512#issuecomment-309268946
Also,
Yarn should be included on heroku by default (per this article) if you have the webpacker gem in the Gemfile.

Related

Heroku: xvfb buildpacks not installed

Hi StackOverflow community,
I want to use xvfb buildpack in heroku.
However, I always get the error in this link.
I have a list of buildpacks added in heroku:
* heroku/php
* heroku/python
* https:// github.com/heroku/heroku-buildpack-apt
* https:// elements.heroku.com/buildpacks/captain401/heroku-buildpack-xvfb
$ heroku buildpacks:add heroku/php
$ heroku buildpacks:add heroku/python
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-apt
$ heroku buildpacks:add https://elements.heroku.com/buildpacks/captain401/heroku-buildpack-xvfb
$ git push heroku master
Everything is up to date
$ heroku logs --tail
app[web.1]: cmd=['Xvfb','-help']
app[web.1]: ubuntu_package=PACKAGE).check_installed()
app[web.1]: Program install error!
app[web.1]: __init__.py", line 180, in check_installed
app[web.1]: raise EasyProcessCheckInstalledError(self)
app[web.1]: [2017-05-15 03:31:42] app.DEBUG: < 200 [] []
app[web.1]: OSError=[Errno 2] No such file or directory
What seems to be wrong?
I've made things work using https://github.com/heroku/heroku-buildpack-apt.
Specifically running:
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

Error: unable to run browserify in production (Heroku)

I've setup Browserify in development and it works great. But when I try pushing the application to Heroku, the push fails.
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
Error:
remote: BrowserifyRails::BrowserifyError: Unable to run
node_modules/.bin/browserify. Ensure you have installed it with npm.
I can confirm browserify is in package.json.
"browserify": "~10.2.4",
"browserify-incremental": "^3.0.1",
And that the files do exist in that location.
Note that the application was recently moved from running on Webrick to Puma but I see no indication here of that as an issue.
I'm not really sure where to start troubleshooting this. Could anyone share advice on what I should try next, or what could be causing this?
Here is the way to handle this issue:
Configure Heroku to use multi-buildpack
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
Create .buildpacks file
Create .buildpacks file for the multi-buildpack to make sure node.js is compiled before ruby.
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-ruby
Install browserify with --save
rake assets:precompile in heroku deploy expects browserify to be installed in .node_modules directory. So move it from devDependencies to dependencies.
npm uninstall browserify --save-dev
npm install browserify --save
Now try to deploy again!
git push heroku master
It should work now.
Use heroku buildpacks:add --index 1 heroku/nodejs.
heroku-buildpack-multi and use of .buildpacks file has been deprecated.
I had this today. Here's what worked for me
Changed browserify to a regular dependency as the accepted answer did.
Reordered buildpacks to put heroku/nodejs first.
Changed package.json from this
"devDependencies": {
"browserify": "^12.0.1",
...
}
To this
"dependencies": {
"browserify": "^12.0.1",
...
}
Reorder buildpacks
The initial output of heroku buildpacks was
1. heroku/ruby
2. heroku/nodejs
So I did
$ heroku buildpacks:remove heroku/ruby
$ heroku buildpacks:add heroku/ruby
Which changed it to
1. heroku/nodejs
2. heroku/ruby

What to do if "git push heroku master" failed?

I have a working Rails app on my local Windows XP machine. I want to upload it on Heroku. I follow this tutorial https://devcenter.heroku.com/articles/rails3.
When I ran git push heroku master, it failed:
-----> Ruby/Rails app detected
-----> WARNING: Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Received disconnect from 50.19.85.132: 10: user closed connection
fatal: The remote end hung up unexpectedly
What do I have to do now?
I saw the log, there are some issues like these ones:
2013-04-28T21:18:03.384881+00:00 app[web.1]: /app/app/assets/images/cards/resize.rb:23:in `open': No such file or directory -
C:\sbox\ruby\cards2 (Errno::ENOENT)
2013-04-28T21:18:03.385662+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in
`wrapped_app'
2013-04-28T21:18:04.689716+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-28T21:18:05.596424+00:00 heroku[web.1]: Process exited with status 1
2013-04-28T21:28:27.556270+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-28T21:28:29.459229+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 3598`
2013-04-28T21:18:03.385424+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/con
figurable.rb:30:in `method_missing'
2013-04-28T21:28:34.613321+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/con
figurable.rb:30:in `method_missing'
I removed resize.rb:23 file. It is for re-sizing images, app doesn't use, I just left it there on development and forgot to delete when uploaded my app on Heroku. On my local machine it is not run by itself, but Heroku for some reason started it. There was a function call to C:\sbox\ruby\cards2 location and that's why the error happened, I thought. Ok, I removed the file. Do not know, though, about other issues.
But what do I need to do now? How to start the process again? I ran git push heroku master again but got:
C:\sbox\ruby\Sites\Heroku\Cards>git push heroku master
Everything up-to-date
Nothing works but Heroku says that everything is up-to-date.
Is there a way to see all my app files on Heroku server the way you can see your files on shared hosting?
Try adding a commit with some small change, like a Readme change or something. It should force heroku to re-deploy your app.

Jekyll on Heroku: bundler: command not found: thin

Working from a tutorial at http://mwmanning.com/2011/11/29/Run-Your-Jekyll-Site-On-Heroku.html. When I try to push to heroku I get a "build failed" message in the output.
Heroku logs shows
2013-01-30T05:29:54+00:00 heroku[slugc]: Slug compilation started
2013-01-30T05:31:36+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rack app
2013-01-30T05:31:38+00:00 heroku[web.1]: State changed from crashed to starting
2013-01-30T05:31:51+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 14276 -e $RACK_ENV`
2013-01-30T05:31:53+00:00 app[web.1]: bundler: command not found: thin
2013-01-30T05:31:53+00:00 app[web.1]: Install missing gem executables with `bundle install`
2013-01-30T05:31:54+00:00 heroku[web.1]: Process exited with status 1272013-01-30T05:31:54+00:00 heroku[web.1]: State changed from starting to crashed
Gemfile and Gemfile.lock both show that thin is installed.
source :rubygems
gem 'jekyll'
gem 'rdiscount'
gem 'rack-jekyll'
gem 'thin'
gem 'RedCloth'
Command bundle exec thin start works locally and bundle show thin shows that thin is installed specifically for the current gemset.
I can't understand why heroku still says that thin is missing?
For me a local bundle update fixed that problem.
Sorry, not a direct answer. But this method worked for me.
http://chriscontinanza.com/2011/06/15/Jekyll-to-heroku.html

Heroku Error: No such file or directory after Bamboo - Cedar upgrade

I've upgraded my app from Bamboo to Cedar following the instructions here. My problem now is whenever I run any heroku command on the new heroku app I receive the following error
$ heroku run rake db:migrate --app my-app
Running `rake db:migrate` attached to terminal... up, run.1
Error: No such file or directory
The error does not tell me which file is causing this problem so most of the related posts haven't been applicable to this particular problem
The same error occurs for heroku run console, or even heroku run why_wont_this_work
I attempted heroku update, was yelled at for not having the Heroku Toolbelt, installed that, and still get yelled at for not having the Heroku Toolbelt.

Resources