New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heroku: error Command "webpack" not found. #512
Comments
@tchret Hey, did you move dependencies under |
@gauravtiwari: Hi, thanks for your answer.
|
@tchret Sorry, I should have been more clear. Basically all dependencies needs to live under dependencies key except |
@gauravtiwari Ok got it! I think it's good on this side (see gist) |
@tchret Ahh there we go - Are you using any heroku buildpacks? |
@gauravtiwari No, nothing. Am i supposed to? |
@tchret No, I was just checking if that's overriding the default one. The default ruby buildpacks now takes care of this with webpacker gem. BTW, could you please add these two buildpacks and try deploying again - heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 2 heroku/ruby |
@gauravtiwari: haaaa the nodejs one was missing :) Thank you so much man 🙏🏼 |
@tchret Great 👍 no worries, glad it's working |
@tchret Hey, seems like I found the main issue - Do you a yarn binstub inside bin folder? |
Seems like the yarn install task is invoked but there is no yarn binstub present since you were using Rails 4 earlier. Please regenerate them - |
@tchret The above command won't work, try this: bundle config --delete bin
# Will create yarn binstub
rails app:update:bin
git add bin |
Running |
…s and ruby buildpacks (rails/webpacker#512)
It seems that rails webpacker expects dependencies like webpack and babel presets to be in dependencies versus devDependencies: rails/webpacker#512
Where did you run that command - from your local terminal, or in heroku? |
I just encountered this problem with a fresh vanilla rails app on a fresh vanilla heroku app. on first push i got this:
and then at the end…
setting the two buildpacks as described here fixed it. |
Hello 👋 I maintain the Ruby buildpack. The ruby buildpack provides both node and yarn, though you can specify a specific version if you desire by also using the nodejs buildpack. One thing to watch out for here with this specific error is that the
|
n.b. if using brightbox ruby with also, unrelated to this card, -begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end |
The contents of
I think spring no longer hooks into the binstubs but rather is somewhere else now. |
here's what #!/usr/bin/env ruby2.6
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands' |
Weird I don't get that with the same command. I'm using
|
I'm getting this same error. I was using the ruby and nodejs buildpack, but based on @schneems feedback I removed nodejs. Neither way can seem to find webpack (with nodejs buildpack or without). bin folder Tail of failure log I see this warning package.json {
"name": "name",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0-alpha",
"@rails/activestorage": "^6.0.0-alpha",
"@rails/ujs": "^6.0.0-alpha",
"@rails/webpacker": "^4.0.7",
"bootstrap": "4.3.1",
"datatables.net": "^1.10.20",
"datatables.net-bs4": "^1.10.20",
"datatables.net-dt": "^1.10.20",
"datatables.net-responsive": "^2.2.3",
"datatables.net-responsive-bs4": "^2.2.3",
"jquery": "^3.4.1",
"popper.js": "^1.15.0",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack": "latest",
"webpack-dev-server": "^3.8.0"
}
} I've tried regenerated bins using Ruby: 2.6.5 |
What's the contents of your
|
Fresh app here, rails 6
|
Fresh app, Rails 6.0.3.2, nodejs and ruby buildpacks added.
Adding webpack to the devDependencies solves one warning:
but doesn't solve the error, can't get it working on Heroku:
|
Also getting this error on a fresh rails app. Doesn't matter if rails/webpacker is a dependency or devDependency, I get the same error regardless |
@balalnaeem did you figure out this error? I've got the exact same error. I have just encountered this issues and am not sure how to fix it. |
In your app, what's the first line of bin/rails? does it point to an oddly named ruby only relevant to your dev environment? if so, change it to just be |
The first line is |
Any update on this issue? I haven't been able to deploy to heroku for months because of this. |
Nope. |
I added this line to
To stop generating the webpacker directories for new projects. |
I think must be because Heroku does not have
|
@schneems : I tried |
This also worked for me. Thanks! |
I just ran into this in a brand new Rails 6.1.3 app. None of the solutions in this thread worked for me. What did work was adding webpacker to
Then I did |
This worked for me. Thanks! 🎉 |
Guys, the year is 2022, the month is almost June, and I get the exact same error when installing a fresh vanilla rails app. Gemfile specifies: Why does the most vanilla rails deploy still fail? I've added the ruby and js buildpacks as well, with ruby first, meaning heroku is correctly detecting it as a ruby app. |
Does the same thing happen in rails 7? |
Yes, updating a rails app from 6.1 to 7.0 gives the same error, the only thing that seems to work is |
Hello,
I spent the day migrating an old rails 4 app with the gem react_rails to a new
rails 5.1
app withwebpacker
.Everything works perfectly well, except when I try to deploy the app on heroku.
The text was updated successfully, but these errors were encountered: