After try to deploy a simple rails test app into heroku, in the terminal poped up this
Uglifier::Error: Name expected
in the middle of the assets compilation.
i've searched and i did not find anything related to this, so someone ahs any idea this name expected is about?
remote: I, [2018-04-27T20:10:19.341334 #1686] INFO -- : Writing /tmp/build_171697f13e39a581026e766b205b8f86/public/assets/white-774a5ae6a58216b107623782ce2e1820ebb64f9d294cad32e132c086866f3dd2.png
remote: rake aborted!
remote: Uglifier::Error: Name expected
remote:
/tmp/build_171697f13e39a5810263766b205b8f86/vendor/bundle/ruby/2.3.0/gems/uglifier-4.1.4/lib/uglifier.rb:234:in `parse_result'
Make sure your asset pre-compilation works locally
bundle exec rake assets:precompile
If there are any errors that should help you find where they are happening.
Also see possible duplicate of Heroku Precompiling Assets Failed
Related
When I put $git push heroku master, I got an argument error:
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: ArgumentError: secret_key_base for production environment must be a type of String
remote: /tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:583:invalidate_secret_key_base'
remote: /tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:432:in secret_key_base'
remote: /tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:176:inkey_generator'
remote: /tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:205:in `message_verifier'
.......................
My Rails version is 5.2 and which has new encrypt system filed in config/credentials.yml.enc. I guess this configuration makes this heroku error.
No one has this question and describe how to solve this error.
Could you please help me how to solve this error? Thanks.
https://waiyanyoon.com/deploying-rails-5-2-applications-with-encrypted-credentials-using-capistrano/
also before pushing to heroku try to compile assets in PRODUCTION mode locally to see if everything works.
I am attempting to push to Heroku and am getting the following error:
remote: -----> Detecting rake tasks
remote: sh: 2: Syntax error: Unterminated quoted string
remote: sh: 2: Syntax error: Unterminated quoted string
remote: !
remote: ! Could not detect rake tasks
remote: ! ensure you can run `$ bundle exec rake -P` against your app
remote: ! and using the production group of your Gemfile.
remote: ! rake aborted!
remote: ! Errno::ENOENT: No such file or directory # rb_sysopen - /tmp/build_0ea6e71e6fa31065be1c41a3cb6aaacb/config/application.yml
Running bundle exec rake -P works without any errors.
application.yml is part of my .gitignore, so I'm confused why the error message has to do with this file and why it's preventing me from pushing to Heroku.
Any ideas?
It turned out to be a silly mistake but posting here in case it's useful to anyone else - I was pushing the wrong branch to heroku. Once I corrected the branch name, it worked perfectly.
I am trying to deploy Heroku but I still have same error:
rake aborted!
remote: Sass::SyntaxError: Invalid CSS after ".../sass-lang.com/": expected "{", was ""
remote: /tmp/build_fa42ee7d4fc8aec796bb9d2efab757a3/app/assets/stylesheets/todo_tasks.scss:4
I have removed todo_tasks.scss, it is no longer in the app on github but still I have this error,
I tried even installing heroku one more time ^^
What should I do?
I'm having a hard time diagnosing why the rake assets:precompile function is failing when pushing to heroku.
Here's an excerpt of my failure message:
remote: I, [2015-09-27T23:13:38.130174 #1566] INFO -- : Writing /tmp/build_ece222744980130b2be8b337003ec99c/public/assets/application-c7927379441221ea1d8a9e016fe470ae6acdbe343094861d91f0dade373344d4.js
remote: rake aborted!
remote: Sass::SyntaxError: Invalid CSS after " */": expected "}", was ""
remote: (sass):7791
remote: /tmp/build_ece222744980130b2be8b337003ec99c/vendor/bundle/ruby/2.0.0/gems/sass-3.4.18/lib/sass/scss/parser.rb:1162:in `expected'
Obviously it is failing due to some JS syntax. I have several Javascripts that I used in conjuction with the Signature Pad application, but only edited a few. In an attempt to diagnose, I removed the 'suspect' edited ones and retried my push, to no avail. I also completed the rake assets:precompile command on my local dev machine, which completed without error.
Does anyone have any advice on how I might narrow my search down?
Found my error. I left out a closing } in one of my CSS statements when I added in print media type
I'm fairly new to rails and web development in general, so maybe I'm forgetting to do something simple, but I've been stuck on this problem for hours. I'm trying to push my rails app to Heroku, and I keep getting a message "Precompiling assets failed". Scrolling up through the console, the only place I really see errors is
Running: rake assets:precompile
remote: I, [2015-06-09T16:33:23.020943 #736] INFO -- : Writing /tmp/build_a3606aeafbcd156e85ce23a261b8ffd5/public/assets/logo-7f005e1459dfe2528e40b953dcc9b0d4.png
remote: PG::UndefinedTable: ERROR: relation "speed_records" does not exist
remote: LINE 1: SELECT "speed_records".* FROM "speed_records"
remote: ^
remote: : SELECT "speed_records".* FROM "speed_records"
remote: rake aborted!
remote: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "speed_records" does not exist
remote: LINE 1: SELECT "speed_records".* FROM "speed_records"
remote: ^
remote: : SELECT "speed_records".* FROM "speed_records"
remote: (in /tmp/build_a3606aeafbcd156e85ce23a261b8ffd5/app/assets/javascripts/googlemaps.js.erb)
remote: /tmp/build_a3606aeafbcd156e85ce23a261b8ffd5/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec'
This is a small project that I'm working with others on, and we're all deploying to separate Heroku apps to test our own work as one of the APIs that we're using doesn't work when run on localhost:3000. Other than that, the site runs fine on localhost, but Heroku won't allow me to push to it without errors. Even when I delete everything that I have locally, and clone the master branch from scratch, which is already hosted and working fine on a different Heroku, I still get an error when I try to push it myself. I think part of the issue could be related to the fact that we use the sqlite3 gem for development, but postgres for production, as Heroku requires. However I'm really new to working with databases so I have no idea if that is actually correct or if I'm forgetting to do anything.
Thanks in advance for any help, I've spent hours googling this issue and am completely stumped.
edit: found the solution after spending way too much time on it. The root of the problem seemed to be that I wasn't using "bundle exec" before all my attempted rake commands. From my understanding, this is necessary when the versions of gems you're using for a specific project don't match the versions you've installed system wide.
You need to run migrations. It looks like one of your .js.erb assets is loading some data from a database table that doesn't exist.
You can fix this by running rake db:migrate before you run rake assets:precompile, but you should be aware that your assets will not be dynamically recomputed once precompiled, and whatever data exists in the database at the point of precompilation is the data you'll be stuck using.
I am also faced this type of issue.
Open config/environments/production.rb and make sure the following option is set to true:
then please run
rake assets:precompile --trace RAILS_ENV=production