将RoR推送到heroku RoR教程

时间:2014-06-19 06:51:53

标签: ruby-on-rails ruby git heroku

我第一次尝试学习Ruby on Rails,安装/设置是很多东西,我遇到了一些麻烦。特别是http://www.railstutorial.org/book/beginning#uid28 Heroku设置的1.4.2部分。

当我输入命令git push heroku master时,我收到错误,导致我无法继续学习本教程。如果我应该提供任何其他信息,请告诉我。

问题似乎是

Running: rake assets:precompile
       rake aborted!
       NoMethodError: undefined method `configure' for #<FirstApp::Application:0x007fee78f193e8>

但是在本教程中,我不记得创建/编辑任何名为configure

的方法

的Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
group :development do
  gem 'sqlite3', '1.3.8'
end


# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.1'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 2.1.1'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '3.0.4'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'
# bundle exec rake doc:rails generates the API under doc/api.
group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
  gem 'rails_12factor', '0.0.2'
end

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

ruby '2.0.0'
# ruby-gemset=railstutorial_rails_4_0

MSG:

-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       NoMethodError: undefined method `configure' for #<FirstApp::Application:0x007fee78f193e8>
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/config/environments/production.rb:1:in `<top (required)>'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/engine.rb:590:in `each'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/engine.rb:590:in `block in <class:Engine>'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:30:in `run'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:44:in `each'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:44:in `tsort_each_child'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/application.rb:215:in `initialize!'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/config/environment.rb:5:in `<top (required)>'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/application.rb:189:in `require_environment!'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/application.rb:250:in `block in run_tasks_blocks'
       /tmp/build_07914188-f9fb-4a8e-bfb4-5a9d47e43d61/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:still-crag-4202.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:still-crag-4202.git'

1 个答案:

答案 0 :(得分:0)

<强>配置

这是您的细读错误:

  

未定义的方法`configure'

-

问题似乎是您在configure / config/application.rb / config/environments/development.rb个文件

中有“config/environments/production.rb”的某种引用

我刚看到你的编辑,然后去教程看看是什么。我找不到configure的任何引用,所以我去找了一些答案,找到了this

  

我通过以下步骤解决了这个问题。

     

第1步:转到app / config / initializers / development.rb

     

更改此行

     

Rails.application.configure do

     

Your_Rails_Application_Folder_name::Application.configure do   示例

     

我的rails项目文件夹名称为'Spree_demo'   **Your_Rails_Application_Folder_name**

     

在以下一行

     

Your_Rails_Application_Folder_name::Application.configure会这样做   替换为

     

SpreeDemo::Application.configure请注意:请参阅下划线   应用程序文件夹名称被删除。

     

希望它适合你们。