I found this error while running "git push heroku master". I have tried all the available solutions on stackoverflow but doesn't work for me.
gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:60:in `block (2 levels) i
n define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:aqueous-eyrie-6143.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:aqueous-eyrie- 6143.git'
here is my production log
You should run the rake assets:precompile RAILS_ENV=production on your local machine and look at the production.log for possible errors before pushing to heroku
Related
Did some research but can't figure out what caused the rejection when I tried to git push heroku master.
Here is my the git repo: https://github.com/leonahu/IMGfeed
and this is the details of the rejection:
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
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 feedimg.
remote:
The error says that the assets failed to precompile, so you should precompile them by running bundle exec rake assets:precompile
Or specifically for production run RAILS_ENV=production bundle exec rake assets:precompile
Make sure that you have this line of code in your config/application.rb file: config.assets.initialize_on_precompile = false
After this, try to push to heroku again
I think you might forget to set config.secret_key_base in production. Run:
heroku config:set SECRET_KEY_BASE=your_secret_key_base
To get a new secret key you can run bundle exec rake secret in the project's root folder.
I tried all the suggestions above but it did not work on my app ( Thanks everyone who tried to help nevertheless.)
What ended up working for me is I basically forced the Heroku by running:
git push heroku master --force
After that, I was able to git push heroku master again.
I have created a simple site built on RoR. I've created a Git repository and have tried to deploy to Heroku but it keeps failing:
remote: rake aborted!
remote: ExecJS::ProgramError: Unexpected character '#' (line: 10848, col: 0, pos: 303135)
remote: Error
remote: at new JS_Parse_Error (/tmp/execjs20151027-1005-1i4h7l5js:2359:10623)
remote: at js_error (/tmp/execjs20151027-1005-1i4h7l5js:2359:10842)
(made a break in the errors for brevity)
remote: Tasks: TOP => assets:precompile
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to serene-depths-4806.
remote:
To https://git.heroku.com/serene-depths-4806.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/serene-depths-4806.git'
Is it saying that there is a '#' that shouldn't be there? I'm not sure how to find that even though the line is given.
Also, I had changed from sqlite to postgresql and made the changes in the gemfile and database.yml file. I then deleted the old Heroku remote branch and followed these instructions to try and deploy: https://devcenter.heroku.com/articles/git#deploying-code
Any advice is appreciated!
Ah, of course after writing that post, I found the answer (for those who might have the same issue in the future):
It's because the '#' error was in a .js file I had converted from the automated coffeescript files. Doh! I just deleted the commentary at the top of the file and it deployed.
This could be the result of assets precompilation failed and prevents the heroku deployment process.
You can try compiling assets locally to inspect the the error
RAILS_ENV=production bundle exec rake assets:precompile --trace
I'm trying to push my rails project onto heroku but I keep receiving this message:
remote: ! Heroku Git error, please try again shortly.
remote: ! See http://status.heroku.com for current Heroku
platform status.
remote: ! If the problem persists, please open a ticket
remote: ! on https://help.heroku.com/tickets/new
remote: ! and provide the Request ID
a0ec0d23-526d-4482-a06e-88129776d9af
remote:
To https://git.heroku.com/gracepinteresting.git ! [remote rejected]
master -> master (pre-receive hook declined) error: failed to push
some refs to 'https://git.heroku.com/gracepinteresting.git'
Here's a link to the project at github: https://github.com/gracek93/pinteresting
What am I doing wrong?
heroku has difficulty today. The better now is wait for that Heroku fix their bugs. Check heroku status here
I'm doing an application in RoR from Linux/Ubuntu and deploying in Heroku but when I try to push to Heroku I get this error:
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:herokuangelapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:herokuangelapp.git'
Thanks for your help.
Precompilation
Without knowing the exact error, the question arises as to what the error itself is saying. The problem you have is Heroku's precompilation system won't be able to precompile the assets for your Rails application (obviously)
The causes of this could be numerous, but the main culprit is that you have syntax errors in your asset files, preventing them from being precompiled.
--
Local
As recommended in the comments, you should precompile the assets locally using the following command:
$ rake assets:precompile RAILS_ENV=production
This will run the precompilation process on your local machine, and will return any exceptions that occur throughout the process.
In order to get it working, you need to clean up any of the syntax errors which are returned with this local precompilation process
So I created a Rails 4 app and was able to push it upstream to Heroku properly the first time. Every since then I haven't been regularly pushing my changes. I just got to a very significant checkpoint and decided to try to push my changes to the actual site on heroku but it rejects my request saying that it failed to compile my Ruby app. I've copy and pasted some of the feedback my command line provided me with in hopes that someone has had a similar error and can give me some ideas as to what might be wrong. Thanks in advance.
Running: rake assets:precompile
rake aborted!
ExecJS::ProgramError: Unexpected token name «users», expected punc «,» (line: 11341, col: 35, pos: 318042)
Error
at new JS_Parse_Error (/tmp/execjs20140625-619-93tzcv.js:2357:10754)
at js_error (/tmp/execjs20140625-619-93tzcv.js:2357:10973)
at croak (/tmp/execjs20140625-619-93tzcv.js:2357:19198)
at token_error (/tmp/execjs20140625-619-93tzcv.js:2357:19335)
at expect_token (/tmp/execjs20140625-619-93tzcv.js:2357:19558)
at expect (/tmp/execjs20140625-619-93tzcv.js:2357:19696)
at expr_list (/tmp/execjs20140625-619-93tzcv.js:2357:27763)
at /tmp/execjs20140625-619-93tzcv.js:2357:29817
at /tmp/execjs20140625-619-93tzcv.js:2357:27576
at /tmp/execjs20140625-619-93tzcv.js:2357:30108
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:picritique.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:picritique.git'
A similar error occurred to me recently when deploying a rails 4 app on heroku, and what I did was to precompile the assets in my local machine and then send them to heroku.
Try to do in your local:
rake assets:precompile
git add .
git commit -m 'assets precompiled locally'
git push heroku master
And it worked. I haven't figured the reason yet to do this, so any insight on this will be appreciated. It just worked for me in this way.
Seems like maybe you've got an error in your JavaScript. Are you able to run RAILS_ENV=production rake assets:precompile --trace locally?
I was making mistake in code as below
_companyService.get({companyId },function(result) {...
Fixed it as
_companyService.get({ companyId: companyId },function(result) {...