I got some errors when deploying Heroku I hope it helps the solution.
ruby 2.5.7 Rails 5.2.4.3 OS: macOS Catalina
1 Check the error in the terminal 2 Log in to my page on heroku 3 Examine the error location 4 Clear the error
https://dashboard.heroku.com/apps Please log in here. At first, a confirmation screen will appear, but you can accept it as it is. (Please translate and check just in case)
After logging in, there is a link for the created app name, so click it and There is "Latest activity" on the right side, If you see a deployment error below it, The X mark is in red.
If you jump to the "View build log" next to it, you will find a detailed error.
The error that actually occurred is described below, so I hope you can refer to it.
Precompiling assets failed.
Terminal
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
It's in the middle of the log, so look for the Error character.
heroku/ViewBuildLog
...
Uglifier::Error: Unexpected token: name (mapping). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
--
...
18254
18255
18256
18257
18258 function initMap(){
=> let mapping
...
In this case, the description of let uses ES6 syntax and an error occurred. The solution is ①
config/environments/production.rb
config.assets.js_compressor = :uglifier
↓
config.assets.js_compressor = :Uglifier.new(:harmony => true)
②
app/aseets/application.js
function initMap(){
let mapping
↓
function initMap(){
var mapping
In my case, I tried ①, but I couldn't solve the error, so I solved it in ②.
Of course, most errors can be resolved by searching for the wording of the error as it is. However, if the situation is different for each individual, it may not be possible to deal with it with the same solution. I think it is important to know the various solutions. I hope you find it helpful.
Also, on twitter, technologies and ideas that have not been uploaded to Qiita are also uploaded, so I would be grateful if you could follow me. Click here for details https://twitter.com/japwork
Recommended Posts