NameError:未初始化的常量Sprockets :: Rails :: VERSION推送到heroku

问题描述:

我有一个应用程序在本地机器上运行。NameError:未初始化的常量Sprockets :: Rails :: VERSION推送到heroku

的Rails 4.2.0

红宝石2.2.3

我正在上推到Heroku的下列错误。该应用在本地机器上运行。

耙错误NameError: uninitialized constant Sprockets::Rails::VERSION

Counting objects: 1965, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (608/608), done. 

Writing objects: 100% (1965/1965), 229.38 KiB | 0 bytes/s, done. 
Total 1965 (delta 1275), reused 1958 (delta 1272) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Ruby app detected 
remote: -----> Compiling Ruby/Rails 
remote: -----> Using Ruby version: ruby-2.2.3 
remote: ###### WARNING: 
remote:  Removing `Gemfile.lock` because it was generated on Windows. 
remote:  Bundler will do a full resolve so native gems are handled properly. 
remote:  This may result in unexpected gem versions being used in your app. 
remote:  In rare occasions Bundler may not be able to resolve your dependencies at all. 
remote:  https://devcenter.heroku.com/articles/bundler-windows-gemfile 
remote: 
remote: -----> Installing dependencies using bundler 1.11.2 
remote:  Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 
remote:  Fetching git://github.com/derekprior/momentjs-rails.git 
remote:  Fetching git://github.com/zpaulovics/datetimepicker-rails.git 
remote:  Cloning into 'bootstrap-datetimepicker'... 
remote:  Fetching gem metadata from https://rubygems.org/........... 
remote:  Fetching version metadata from https://rubygems.org/... 
remote:  Fetching dependency metadata from https://rubygems.org/.. 
remote:  Resolving dependencies.......................................... 
remote:  Installing json 1.8.3 with native extensions 
remote:  Installing rake 11.1.2 
remote:  Installing i18n 0.7.0 
remote:  Installing minitest 5.8.4 
remote:  Installing thread_safe 0.3.5 
remote:  Installing builder 3.2.2 
remote:  Installing erubis 2.7.0 
remote:  Installing mini_portile2 2.0.0 
remote:  Installing rack 1.6.4 
remote:  Installing mime-types 2.99.1 
remote:  Installing arel 6.0.3 
remote:  Installing execjs 2.6.0 
remote:  Installing bcrypt 3.1.11 with native extensions 
remote:  Installing bootstrap_form 2.3.0 
remote:  Installing sass 3.4.22 
remote:  Using bundler 1.11.2 
remote:  Installing thor 0.19.1 
remote:  Installing hike 1.2.3 
remote:  Installing multi_json 1.11.3 
remote:  Installing tilt 1.4.1 
remote:  Installing coffee-script-source 1.10.0 
remote:  Installing daemons 1.2.3 
remote:  Installing orm_adapter 0.5.0 
remote:  Installing eventmachine 1.0.9.1 with native extensions 
remote:  Installing unf_ext 0.0.7.2 with native extensions 
remote:  Installing fabrication 2.15.0 
remote:  Installing google_visualr 2.5.1 
remote:  Installing sexp_processor 4.7.0 
remote:  Installing hashie 3.4.3 
remote:  Installing json_pure 1.8.3 
remote:  Installing libv8 3.16.14.13 
remote:  Installing nested_form 0.3.2 
remote:  Installing netrc 0.11.0 
remote:  Installing pg 0.18.4 with native extensions 
remote:  Installing phony 2.15.21 
remote:  Installing rails_serve_static_assets 0.0.5 
remote:  Installing rails_stdout_logging 0.0.5 
remote:  Installing remotipart 1.2.1 
remote:  Installing safe_yaml 1.0.4 
remote:  Installing ref 2.0.0 
remote:  Installing faker 1.6.3 
remote:  Installing validates_email_format_of 1.6.3 
remote:  Installing tzinfo 1.2.2 
remote:  Installing nokogiri 1.6.7.2 with native extensions 
remote:  Installing rack-test 0.6.3 
remote:  Installing rack-protection 1.5.3 
remote:  Installing warden 1.2.6 
remote:  Installing mail 2.6.4 
remote:  Installing rdoc 4.2.2 
remote:  Installing autoprefixer-rails 6.3.6 
remote:  Installing uglifier 3.0.0 
remote:  Installing figaro 1.1.1 
remote:  Installing sprockets 2.12.4 
remote:  Installing haml 4.0.7 
remote:  Installing coffee-script 2.4.1 
remote:  Installing ruby_parser 3.8.1 
remote:  Installing unf 0.1.4 
remote:  Installing tropo-webapi-ruby 0.1.13 
remote:  Installing therubyracer 0.12.2 with native extensions 
remote:  Installing rails_12factor 0.0.3 
remote:  Installing activesupport 4.2.0 
remote:  Installing sinatra 1.4.7 
remote:  Installing sdoc 0.4.1 
remote:  Installing bootstrap-sass 3.3.6 
remote:  Installing domain_name 0.5.20160310 
remote:  Installing rails-deprecated_sanitizer 1.0.3 
remote:  Installing globalid 0.3.6 
remote:  Installing activemodel 4.2.0 
remote:  Installing clockwork 2.0.0 
remote:  Installing delayed_job 4.1.1 
remote:  Installing jbuilder 1.5.3 
remote:  Installing phony_rails 0.14.0 
remote:  Installing http-cookie 1.0.2 
remote:  Installing rails-dom-testing 1.0.7 
remote:  Installing loofah 2.0.3 
remote:  Installing html2haml 2.0.0 
remote:  Installing rack-pjax 0.8.0 
remote:  Installing activejob 4.2.0 
remote:  Installing activerecord 4.2.0 
remote:  Installing rest-client 1.8.0 
remote:  Installing rails-html-sanitizer 1.0.3 
remote:  Installing delayed_job_active_record 4.1.0 
remote:  Installing delayed_job_web 1.2.10 
remote:  Installing has_secure_token 1.0.0 
remote:  Installing actionview 4.2.0 
remote:  Installing actionpack 4.2.0 
remote:  Installing railties 4.2.0 
remote:  Installing actionmailer 4.2.0 
remote:  Installing sprockets-rails 2.0.1 
remote:  Installing kaminari 0.16.3 
remote:  Installing simple_form 3.1.1 
remote:  Installing jquery-rails 4.1.1 
remote:  Using momentjs-rails 2.11.1 from git://github.com/derekprior/momentjs-rails.git (at [email protected]) 
remote:  Installing coffee-rails 4.0.1 
remote:  Installing responders 2.1.2 
remote:  Installing font-awesome-rails 4.6.1.0 
remote:  Installing jquery-ui-rails 5.0.5 
remote:  Installing haml-rails 0.9.0 
remote:  Installing rails 4.2.0 
remote:  Installing turbolinks 2.5.3 
remote:  Using datetimepicker-rails 4.7.16 from git://github.com/zpaulovics/datetimepicker-rails.git (at [email protected]) 
remote:  Installing sass-rails 4.0.1 
remote:  Installing devise 4.0.1 
remote:  Installing browser-timezone-rails 0.0.8 
remote:  Installing fullcalendar-rails 2.6.1.0 
remote:  Installing dateslices 0.0.4 
remote:  Installing jquery-turbolinks 2.1.0 
remote:  Installing jquery-datatables-rails 3.3.0 
remote:  Installing rails_admin 0.8.1 
remote:  Bundle complete! 52 Gemfile dependencies, 109 gems now installed 
remote:  Gems in the groups development and test were not installed. 
remote:  Bundled gems are installed into ./vendor/bundle. 
remote:  Post-install message from rdoc: 
remote:  Depending on your version of ruby, you may need to install ruby rdoc/ri data: 
remote:  <= 1.8.6 : unsupported 
remote:  = 1.8.7 : gem install rdoc-data; rdoc-data --install 
remote:  = 1.9.1 : gem install rdoc-data; rdoc-data --install 
remote:  >= 1.9.2 : nothing to do! Yay! 
remote:  Post-install message from haml: 
remote:  HEADS UP! Haml 4.0 has many improvements, but also has changes that may break 
remote:  your application: 
remote:  * Support for Ruby 1.8.6 dropped 
remote:  * Support for Rails 2 dropped 
remote:  * Sass filter now always outputs <style> tags 
remote:  * Data attributes are now hyphenated, not underscored 
remote:  * html2haml utility moved to the html2haml gem 
remote:  * Textile and Maruku filters moved to the haml-contrib gem 
remote:  For more info see: 
remote:  http://rubydoc.info/github/haml/haml/file/CHANGELOG.md 
remote:  Post-install message from phony_rails: 
remote:  It now adds a '+' to the normalized number when it starts with a country number! 
remote:  Bundle completed (61.53s) 
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 Sprockets::Rails::VERSION 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/bootstrap-sass-3.3.6/lib/bootstrap-sass/engine.rb:11:in `block in <class:Engine>' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/railtie.rb:194:in `public_send' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/railtie.rb:194:in `method_missing' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/config/environment.rb:5:in `<top (required)>' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:443:in `block in run_tasks_blocks' 
remote:  /tmp/build_ff86312346869b165736d37b1725f32c/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define' 
remote:  Tasks: TOP => environment 
remote:  (See full trace by running task with --trace) 
remote: ! 
remote: !  Precompiling assets failed. 
remote: ! 
remote: 
remote: !  Push rejected, failed to compile Ruby app 
remote: 
remote: Verifying deploy.... 
remote: 
remote: ! Push rejected to fathom-reef-94288. 
remote: 
To https://git.heroku.com/fathomless-reef-94288.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/fathom-reef-94288.git' 

我得到我的本地机器上执行rake assets:precompile以下错误中止。这与我在heroku推送中遇到的错误是一样的。

rake assets:precompile 
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead. 
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead. 
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead. 
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead. 
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead. 
rake aborted! 
NameError: uninitialized constant Sprockets::Rails::VERSION 
/Users/azs/ror/maintr/config/environment.rb:5:in `<top (required)>' 
Tasks: TOP => environment 
(See full trace by running task with --trace) 
+0

如果您尝试在本地执行操作,是否可以预编译资产? –

+0

Marc,我尝试了rake资产:在本地进行预编译,并得到一个与heroku消息相同的错误消息。将在我的帖子上面发布错误。 – sharamb

看起来您已经安装了旧版本的sprockets-rails gem。使用Rails 4.2,您应该获得版本3或更高版本。但是,在你的情况下,打包商正在安装版本2.0.1。某些版本的宝石had this exact problem

我想最简单的方法是在linux机器上生成Gemfile.lock文件,并强制Heroku使用新版本的sprockets-rails宝石。

+0

如何强制heroku使用新版本?我在gemfile中指定了'sprockets-rails〜> 3.0.0'版本,它仍然安装'2.0.1' – sharamb