问题
I'm receiving the following error when trying to push to production. Here's the result of the push:
$ git push production master
Counting objects: 124, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (118/118), done.
Writing objects: 100% (124/124), 19.73 KiB | 0 bytes/s, done.
Total 124 (delta 66), reused 1 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.2
remote: -----> Installing dependencies using 1.9.7
remote: Ruby version change detected. Clearing bundler cache.
remote: Old: ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]
remote: New: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Fetching gem metadata... <omitted>
remote: Installing... <omitted>
remote: Bundle complete! 33 Gemfile dependencies, 70 gems now installed.
remote: Gems in the groups development and test were not installed.
remote: Bundled gems are installed into ./vendor/bundle.
...<misc post install notifications omitted>...
remote: Bundle completed (93.05s)
remote: Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NameError: uninitialized constant Uglifier::VERSION
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/uglifier_compressor.rb:48:in `initialize'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/uglifier_compressor.rb:24:in `new'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/uglifier_compressor.rb:24:in `instance'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/loader.rb:86:in `load_asset_by_uri'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/loader.rb:45:in `block in load'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/loader.rb:156:in `fetch_asset_from_dependency_cache'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/loader.rb:38:in `load'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/cached_environment.rb:47:in `yield'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/cached_environment.rb:47:in `load'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/base.rb:63:in `find_asset'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/base.rb:70:in `find_all_linked_assets'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/manifest.rb:138:in `block in find'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/path_utils.rb:223:in `block in stat_tree'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/path_utils.rb:207:in `block in stat_directory'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/path_utils.rb:204:in `each'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/path_utils.rb:204:in `stat_directory'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/path_utils.rb:222:in `stat_tree'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/legacy.rb:105:in `each'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/legacy.rb:104:in `each'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/legacy.rb:104:in `logical_paths'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/manifest.rb:136:in `find'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/sprockets/manifest.rb:162:in `compile'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-3.1.0/lib/rake/sprocketstask.rb:147:in `with_logger'
remote: /tmp/build_1185918c8fd4fbf904b3d7c2f09505d5/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
remote: Tasks: TOP => assets:precompile
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
回答1:
The problem seemed to be an incompatibility between Sprockets 3.1 and the Uglifier compressor version I was using, 2.1. Upgrading Uglifier by putting this line in my Gemfile resolved the issue:
gem 'uglifier', '~> 2.7'
来源:https://stackoverflow.com/questions/30338860/heroku-push-error-nameerror-uninitialized-constant-uglifierversion-on-rake