资产预编译失败的Rails

时间:2014-06-12 11:10:02

标签: ruby-on-rails git heroku

我输入了git push heroku master,我收到了这个错误。请帮帮我,我被卡住了。有人能告诉我这个文件被卡住了吗?我也尝试过运行

RAILS_ENV=production bundle exec rake assets:precompile 

但它显示了同样的问题

我已经在config / application.rb

中添加了这个
config.assets.initialize_on_precompile = false

命令行响应

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

1 个答案:

答案 0 :(得分:0)

您能够在本地复制问题的事实很好。这甚至可能就像一个(或多个)JS文件中的错误放置语法一样简单。事实上,错误看起来就像JS评论错误一样简单:说*而不是/*

我会删除或注释掉整个JS文件,并在本地运行资产预编译命令,以隔离​​哪些JS文件容纳有问题的JS行。

在本地开发模式下运行应用程序时,同样格式错误的JS也很有可能导致您出现问题。我也会在浏览器的Web开发控制台中查看JS错误。