简体   繁体   中英

Asset Precompiling Failed Rails

I typed git push heroku master and I got this error. Please help me I am stuck. Can someone tell me where is this file getting stuck? I also tried running

RAILS_ENV=production bundle exec rake assets:precompile 

but it shows the same problem

I already added this in my config/application.rb

config.assets.initialize_on_precompile = false

Command Line response

salmanalam@ubuntu:~/Rails Projects/CQ$ git push heroku master
Initializing repository, done.
Counting objects: 106, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (94/94), done.
Writing objects: 100% (106/106), 32.32 KiB, done.
Total 106 (delta 24), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.5.2
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   Your Gemfile lists the gem pg (>= 0) more than once.
   You should probably keep only one of them.
   While it's not a problem now, it could cause errors if you change the version of just one of them later.
   Fetching gem metadata from https://rubygems.org/..........
   Fetching additional metadata from https://rubygems.org/..
   Installing minitest (4.7.5)
   Installing multi_json (1.10.1)
   Installing i18n (0.6.9)
   Installing rake (10.3.2)
   Installing builder (3.1.4)
   Installing thread_safe (0.3.4)
   Installing erubis (2.7.0)
   Installing tzinfo (0.3.39)
   Installing mime-types (1.25.1)
   Installing rack (1.5.2)
   Installing polyglot (0.3.5)
   Installing activerecord-deprecated_finders (1.0.3)
   Installing arel (4.0.2)
   Installing coffee-script-source (1.7.0)
   Installing sass (3.2.19)
   Installing execjs (2.2.0)
   Installing hike (1.2.3)
   Using bundler (1.5.2)
   Installing thor (0.19.1)
   Installing rails_serve_static_assets (0.0.2)
   Installing tilt (1.4.1)
   Installing rails_stdout_logging (0.0.3)
   Installing activesupport (4.0.2)
   Installing rack-test (0.6.2)
   Installing treetop (1.4.15)
   Installing json (1.8.1)
   Installing bootstrap-sass (3.1.1.0)
   Installing coffee-script (2.2.0)
   Installing sprockets (2.11.0)
   Installing rails_12factor (0.0.2)
   Installing activemodel (4.0.2)
   Installing jbuilder (1.5.3)
   Installing actionpack (4.0.2)
   Installing mail (2.5.4)
   Installing uglifier (2.5.0)
   Installing rdoc (4.1.1)
   Installing activerecord (4.0.2)
   Installing sprockets-rails (2.0.1)
   Installing railties (4.0.2)
   Installing actionmailer (4.0.2)
   Installing coffee-rails (4.0.1)
   Installing sdoc (0.4.0)
   Installing jquery-rails (3.1.0)
   Installing turbolinks (2.2.2)
   Installing sass-rails (4.0.3)
   Installing rails (4.0.2)
   Installing pg (0.17.1)
   Your bundle is complete!
   Gems in the groups development and test were not installed.
   It was installed into ./vendor/bundle
   Post-install message from rdoc:
   Depending on your version of ruby, you may need to install ruby rdoc/ri data:
   <= 1.8.6 : unsupported
   = 1.8.7 : gem install rdoc-data; rdoc-data --install
   = 1.9.1 : gem install rdoc-data; rdoc-data --install
   >= 1.9.2 : nothing to do! Yay!
   Bundle completed (18.84s)
   Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   rake aborted!
   ExecJS::ProgramError: Unexpected token: operator (*) (line: 13275, col: 0, pos: 372405)
   Error
   at new JS_Parse_Error (/tmp/execjs20140612-994-1djukjajs:2357:10754)
   at js_error (/tmp/execjs20140612-994-1djukjajs:2357:10973)
   at croak (/tmp/execjs20140612-994-1djukjajs:2357:19198)
   at token_error (/tmp/execjs20140612-994-1djukjajs:2357:19335)
   at unexpected (/tmp/execjs20140612-994-1djukjajs:2357:19423)
   at /tmp/execjs20140612-994-1djukjajs:2357:27615
   at /tmp/execjs20140612-994-1djukjajs:2357:30108
   at expr_ops (/tmp/execjs20140612-994-1djukjajs:2357:30866)
   at /tmp/execjs20140612-994-1djukjajs:2357:30958
   at /tmp/execjs20140612-994-1djukjajs:2357:31401 (in /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/app/assets/javascripts/application.js)/tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/execjs-2.2.0/lib/execjs/external_runtime.rb:64:in `extract_result'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/execjs-2.2.0/lib/execjs/external_runtime.rb:29:in `exec'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/uglifier-2.5.0/lib/uglifier.rb:186:in `really_compile'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/uglifier-2.5.0/lib/uglifier.rb:110:in `compile'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/uglifier_compressor.rb:25:in `evaluate'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:25:in `initialize'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
   /tmp/build_a47f0c1e-55d7-4100-a124-5e864d86b763/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
   Tasks: TOP => assets:precompile
   (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

The fact that you are able to replicate the issue locally is good. This could even be something as simple as misplaced syntax in one (or more) of your JS files. In fact, the error looks like it could be as simple as a JS comment being wrong: say * instead of /* .

I would delete or comment out entire JS files and run the assets precompile command locally to isolate which JS file(s) house the problematic JS line(s).

These is a high chance that the same malformed JS is also causing you trouble when running the app in development mode locally, breaking functionality. I'd look at JS errors being spit out in your browser's web development console, as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM