#type :: railtie :: configuration:0x000000056ac200>的未定义方法`assets'

时间:2015-09-04 03:29:28

标签: ruby-on-rails ruby ruby-on-rails-3 heroku

我目前正在尝试将我的Rails 3.2.17应用程序部署到Heroku的cedar-14堆栈。

我收到运行git push heroku master的错误。以下是相关输出:

remote:        Bundle completed (141.81s)
remote:        Cleaning up the bundler cache.
remote: -----> Writing config/database.yml to read from DATABASE_URL
remote:        Could not detect rake tasks
remote:        ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
remote:        and using the production group of your Gemfile.
remote:        rake aborted!
remote:        NoMethodError: undefined method `assets' for #<Rails::Railtie::Configuration:0x007f1e3f3dd998>
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/railties-3.2.17/lib/rails/railtie/configuration.rb:85:in `method_missing'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/gritter-1.2.0/lib/gritter/railtie.rb:7:in `<class:Railtie>'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/gritter-1.2.0/lib/gritter/railtie.rb:3:in `<module:Gritter>'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/gritter-1.2.0/lib/gritter/railtie.rb:2:in `<top (required)>'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `block in require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/gritter-1.2.0/lib/gritter.rb:26:in `<top (required)>'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/config/application.rb:13:in `<top (required)>'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/Rakefile:5:in `require'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/Rakefile:5:in `<top (required)>'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
remote:        /tmp/build_9c69b395977c833063f1bf84ce228ae8/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
remote:        vendor/bundle/bin/rake:16:in `load'
remote:        vendor/bundle/bin/rake:16:in `<main>'
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:        Default types for Ruby  -> console, rake, worker
remote: 
remote: -----> Compressing... done, 58.6MB
remote: -----> Launching... done, v5
remote:        https://alliance-billing-dev.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy.... done.
To https://git.heroku.com/alliance-billing-dev.git
 * [new branch]      master -> master

运行bundle exec rake -P提供类似的输出。我已经阅读了几篇与未找到的资产方法相关的类似帖子,但所有这些帖子似乎都涉及我没有使用的宝石。

我的猜测是我的某个宝石和rails存在兼容性问题。基于其他帖子,有问题的宝石似乎总是在追溯中的轨道之前的宝石。这会让我相信gritter-1.2.0是罪魁祸首。但是,我不知道如何从那里开始,或者我的假设是否正确。

以下是我的Gemfile的内容,以防有助于找到解决方案。

source 'https://rubygems.org'
ruby '2.1.7'
gem 'rails', '3.2.17'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'sendgrid'
gem 'newrelic_rpm'
gem 'unicorn'
gem 'money-rails'
gem 'rack-timeout'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'compass-rails'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end


gem 'activerecord-import'
gem 'bootstrap-sass'
gem 'cancan'
gem 'carrierwave'
gem 'chosen-rails'
gem 'chronic'
gem 'client_side_validations'
gem 'client_side_validations-simple_form'
gem 'date-input-rails'
gem 'default_value_for', git: 'git://github.com/malagoli/default_value_for.git', ref: '3d458733a2'
gem 'fog'
gem 'gritter'
gem 'haml'
gem 'heroku'
gem 'holidays', git: 'git://github.com/braintreeps/holidays.git'
gem 'jquery-rails'
gem 'kaminari'
gem 'less-rails'
gem 'paper_trail', '~> 3.0.0'
gem 'postgres-copy'
gem 'prawn', '~> 1.0.0rc2'
gem 'quiet_assets', :group => :development
gem 'rails-asset-jqueryui'
gem 'ransack', git: 'git://github.com/ernie/ransack.git'
gem 'simple_form'
gem 'sorcery'
gem 'strong_parameters'
gem 'tabs_on_rails', git: 'git://github.com/xn/tabs_on_rails.git'
gem 'therubyracer'
gem 'twitter-bootstrap-rails'

group :development do
  gem 'taps', :require => false # has an sqlite dependency, which heroku hates\
  gem 'sqlite3'
end

group :development, :test do
  #gem 'capybara'
  #gem 'cucumber-rails', :require => false
  gem 'annotate'
  gem 'factory_girl_rails'
  gem 'haml-rails'
  gem 'launchy'
  gem 'pry-rails'
  gem 'rspec-rails'
  gem 'shoulda', :require => false
end

group :test do
  #gem 'capybara-firebug', :require => false
  gem 'database_cleaner'
end

group :production do
  gem 'rails_12factor'
end

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

我确定原因是删除了我的Gemfile.lock。在推送到Heroku(并运行bundle install)之前,我在对gem的安装进行故障排除(调试器1.6.8)时删除了我的Gemfile.lock。

新的Gemfile.lock包含许多与原始版本的差异,这肯定会导致错误。通过回滚并使用原始Gemfile.lock来解决问题。