Heroku Deplyoment Asset Precompiling Failed on Rails 6

Heroku deplyoment asset precompiling failed on rails 6

actually my webpacker is obsolete so I only need to update it to the latest version, then it works again

yarn upgrade @rails/webpacker --latest

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'?

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 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 Deployment Error: Precompiling assets failed – Sprockets::FileNotFound: couldn't find file 'angular' with type 'application/javascript'

Update:

It looks like it was a problem with my post-Bower configuration (I migrated from Bower --> Yarn) I was able to solve Sprockets errors by adding this line to my assets.rb:

Rails.application.config.assets.paths << Rails.root.join('node_modules')

and by running yarn add <package name> for files that Sprockets could not locate.

I also made the following updates to old package names in my `application.rb'

//= require lodash
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require cloudinary/jquery.fileupload
//= require cloudinary/jquery.cloudinary
//= require angular
//= require angular-resource
//= require angular-animate
//= require angular-bootstrap
//= require angular-sanitize
//= require angular-rails-templates
//= require_tree ../templates
//= require bootstrap
//= require external/picker
//= require external/picker.date
//= require angular-filter/dist/angular-filter
//= require swipebox
//= require angular-ui-sortable
//= require bootstrap-select
//= require string-mask/src/string-mask
//= require_tree .



Related Topics



Leave a reply



Submit