Heroku Upload-Precompiling Assets Failed

Heroku upload-Precompiling assets failed

From the Heroku docs:

This means that your app is attempting to connect to the database as part of rake assets:precompile. Because the config vars are not present in the environment, we use a placeholder DATABASE_URL to satisfy Rails.

To resolve this issue, ensure that the following line appears in your config/application.rb:

# config/application.rb
config.assets.initialize_on_precompile = false

Once added, commit your change and redeploy to Heroku – your assets should compile without your app attempting to connect to the database, which should resolve the error you're witnessing.

UPDATE:

Line 46 of your stacktrace includes the following message: Devise.secret_key was not set.

According to the author of Devise, José Valim, this issue can be resolved in the following manner:

Please add the following to your Devise initializer:

config.secret_key = '-- secret key --'

Alternatively, the following solution seems to have worked for a number of users:

I went to my routes.rb file and commented out the line devise_for :installs

Then I went back and reran rails generate devise:install. If that doesn't work, use the previous version of devise by editing your Gemfile's reference to Devise like this: gem 'devise', '3.0.3' and then follow the steps i mentioned above.

Rails Heroku App - Precompiling Assets Failed

The issue already have a solution in the error description itself

To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true)

Solution:

To fix the issue replace the following in config/environments/production.rb

config.assets.js_compressor = :uglifier

with

config.assets.js_compressor = Uglifier.new(harmony: true)

Refer, this issue raised in uglifier https://github.com/lautis/uglifier/issues/127

Heroku: Precompiling assets failed

Just had the same issue, it looks like this has been handled before already. My steps to resolve:

yarn upgrade @rails/webpacker --latest

I had upgrade my version of node to 14.15.0--this may be different to you--using:

nvm install 14.15.0 prior to getting the yarn update to work.

That was it.

Referenced:

Heroku deplyoment asset precompiling failed on rails 6

&

error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?

Precompiling assets failed error when pushing to heroku

ModuleNotFoundError: Module not found: Error: Can't resolve '@popperjs/core' suggests that you need to install @popperjs/core.

Rails 4 Heroku Deployment error: Precompiling assets failed - cannot import/find boostrap file

The issue was that I was making changes while on the develop branch and trying to push them, not realising that (NEWBIES TAKE NOTE) when you do git push heroku master it actually only ever pushes from your local master branch.

So I merged all my changes into my master branch and pushed. Problem solved.

If your setup is similar to mine please take note of the other answers because I am sure taking on those suggestions means I avoided some other errors in my code.

Rails 6 heroku Precompiling assets failed

The problem was caused by not being able to access the credentials.yml in production. We could access the master key value in production as it is not committed.

I fixed the issue by adding the master.key-value in Heroku, under settings, config vars master key

Precompiling Assets Failed Heroku Rails

You can set the env variable manually on Heroku with...

$ heroku config:set S3_BUCKET_NAME=yourbucketname

Heroku deploy failing for rails5 app due to precompiling assets failed

How do you get Heroku to return Don't know how to build task 'assets:precompileRAILS_ENV=production' (See the list of available tasks with rake --tasks) ?

Usually this command : bundle exec rake assets:precompile RAILS_ENV=production is to be done locally in your console. It allows you to compile your assets locally.

Also by doing it locally you may get some information about the file that can't be precompiled. And then try to debug this file. It is either a javascript or a CSS file.

Some possible errors :

  • Js files including ES6 => then you have to use Harmony as advised by
    Mark
  • Some dynamic content (if you have css.erb or js.erb files)

  • Some typo in a JS file (CSS typos trigger warnings all the time)

  • ..



Related Topics



Leave a reply



Submit