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
How to Use 'Debugger' and 'Pry' When Developing a Gem? (Ruby)
In Ruby, How to Know in the Console What a Method Does
How to Translate Arabic/Persian Numbers to English Using Ruby
Ruby: How to Remove Items from Array a If It's Not in Array B
How to Link to a Nested Route Path Inside a Loop
Ruby Roo Loaderror: Cannot Load Such File -- Spreadsheet/Note
Determining Type of an Object in Ruby
How to Seed the Production Database Using the Capistrano Gem
Rails Byebug Did Not Stop Application
Enter & Ioerror: Byte Oriented Read for Character Buffered Io
Pageobject with Ruby - Set Text in a Text Field Only Works in the Main File
How to Make Private Activities
Regex to Extract Boundary and Content Type Out of Mail Headers
Running Rake Task from Within War File
Invalid Route Name, Already in Use: 'Admin_Root' (Argumenterror) - Failed Activeadmin Install