Webpack not found error deploying rails application on heroku - ruby-on-rails

I was attempting to deploy my Ruby on Rails app on Heroku when I faced below issue. (Of course, I've created and deployed on my local machine successfully.)
error Command "webpack" not found.
I don't have a clue about how to even know deploying any apps on heroku.
Of course I tried many ways and there was this error still now.
I referenced the posts that prevent precompiling of assets from here and here.
I followed all steps of above posts and it looked like to fix errors I faced. But I just spent my time. I've add this line config.assets.initialize_on_precompile = false into config/application.rb and saw this GitHub issue because I found this article from Google with error commands. But these was not helpful.
I write my error:
remote: [4/4] Building fresh packages...
remote: Done in 1.77s.
remote: I, [2020-03-23T10:31:49.843316 #3000] INFO -- : Writing /tmp/build_0f0b4f66e4d0e7863926d7ab880dce89/public/assets/manifest-cadda289ef9c70eaa0879a36e6263cb33f7523a16b3ef862e0b8609cdc2bdab1.js
remote: I, [2020-03-23T10:31:49.844161 #3000] INFO -- : Writing /tmp/build_0f0b4f66e4d0e7863926d7ab880dce89/public/assets/manifest-cadda289ef9c70eaa0879a36e6263cb33f7523a16b3ef862e0b8609cdc2bdab1.js.gz
remote: I, [2020-03-23T10:31:49.844830 #3000] INFO -- : Writing /tmp/build_0f0b4f66e4d0e7863926d7ab880dce89/public/assets/application-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
remote: I, [2020-03-23T10:31:49.845459 #3000] INFO -- : Writing /tmp/build_0f0b4f66e4d0e7863926d7ab880dce89/public/assets/application-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
remote: Compiling...
remote: Compilation failed:
remote: yarn run v1.22.4
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote:
remote: error Command "webpack" not found.
remote:
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to evening-sierra-83681.
remote:
To https://git.heroku.com/evening-sierra-83681.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/evening-sierra-83681.git'

Related

Webpack / Yarn Error after Renaming Rails 6.1 App

I had a previously-functional app on Rails 6.1 that had successfully deployed to Heroku.
I (unfortunately) had to rename the app, which I did following these steps.
The app (post renaming) works perfectly on localhost.
I am 100% sure my code-to-Github relationship is working, because new commits show up on Github.
I have since deleted all git remotes as well as the Heroku app. I recreated a Heroku app and set it as a production remote.
I still get the following error every time I try to push to heroku:
remote: Compiling...
remote: Compilation failed:
remote: yarn run v1.22.4
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote:
remote: error Command "webpack" not found.
remote:
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to the-failure-project.
remote:
To https://git.heroku.com/the-failure-project.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/the-failure-project.git'
I tried adding buildpacks, as recommended here:
heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 2 heroku/ruby
I'm stumped. Please help!

failed to push to heroku (pre-receive hook declined)

remote: -----> Compressing...
remote:
! Compiled slug size: 917.2M is too large (max is 500M).
remote: ! See: http://devcenter.heroku.com/articles/slug-size
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 5788bbafef87b6c05d42cc0d2d3175846ae109bf
remote: !
remote: ! We have detected that you have triggered a build from source code with version 5788bbafef87b6c05d42cc0d2d3175846ae109bf
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to appname.
remote:
To https://git.heroku.com/appname.git
please help! have already cleared the cache of the buildpacks. that didn't seem to work. tried pushing code to a different branch and that didn't work either. not sure what's going on. I am the only one working on this project and have only been pushing on master. My app has a lot of photo files don't know if thats the issue?

Can't push to heroku Rails 6. No command webpacker found/precompiling assets failed

When I run
git push heroku master
I get this:
3d03d9a9bed492eab33bdbd65f7.css
remote: I, [2020-11-22T00:08:54.351994 #1614] INFO -- : Writing /tmp/build_9cb71dd2/public/assets/rebel-99a5cf4009e103727878a62db3995432aec733d03d9a9bed492eab33bdbd65f7.css.gz
remote: Compiling...
remote: Compilation failed:
remote: yarn run v1.22.4
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote:
remote: error Command "webpack" not found.
remote:
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
I've searched everywhere what the heck is going on? How do I fix this? Thank!

git push Heroku "Precompiling assets failed"

When I try and push my rails app to Heroku, I get the following problem:
remote: (See full trace by running task with --trace)
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 50f04b554cf0d361879bf0f70d7c445ed0c3a480
remote: !
remote: ! We have detected that you have triggered a build from source code with version 50f04b554cf0d361879bf0f70d7c445ed0c3a480
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to defaceme.
remote:
To https://git.heroku.com/defaceme.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/defaceme.git'
edithkenny#Georginas-MBP defaceme %
I have updates my username on my computer, im not sure if this affected my terminal...Any ideas?

webpacker won't compile when pushing to Heroku

I've recently tried integrating react into my preexisting rails app by using the webpacker gem. When I try to push to heroku, I see the an error message like
remote: [1/5] Validating package.json...
remote: [2/5] Resolving packages...
remote: [3/5] Fetching packages...
remote: [4/5] Linking dependencies...
remote: [5/5] Building fresh packages...
remote: success Saved lockfile.
remote: Done in 0.09s.
remote: Compiling…
remote: Compilation failed:
remote: error Command "webpack" not found.
remote:
remote: yarn run v1.12.3
remote: info Visit https://yarnpkg.com/en/docs/cli/run for
documentation about this command.
remote:
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to spitball-production.
remote:
To https://git.heroku.com/spitball-production.git
! [remote rejected] master -> master (pre-receive hook declined)
My package.json looks like
{
"name": "Spitball",
"private": true,
"dependencies": {
},
"engines": {
"yarn": ">=0.25.2"
}
}
I've tried the solutions involving adding buildpacks and installing yarn and webpacker and so far nothing has helped. I'm expecting everything to push through no problem as all I've done is add the webpacker gem.
Did you try running
$ rails assets:precompile
in your terminal prior to pushing to Github then Heroku?
You have to compile all of your assets files prior to being built by Heroku.

Resources