我正在关注Ruby on Rails教程,目前正在执行此步骤: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-heroku_setup
我不确定我做错了什么,但我相信它可能与Gemfile和PostgreSQL有关。
$ git push heroku master
Enter passphrase for key '/c/Users/Lars/.ssh/id_rsa':
Initializing repository, done.
Counting objects: 85, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (70/70), done.
Writing objects: 100% (85/85), 28.31 KiB | 0 bytes/s, done.
Total 85 (delta 14), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3
-----> Warning:
Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
In rare occasions Bundler may not be able to resolve your dependencies at
all.
https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using 1.5.2
Running: bundle install --without development:test --path vendor/bundle -
-binstubs vendor/bundle/bin -j4
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing builder (3.0.4)
Installing multi_json (1.8.4)
Installing i18n (0.6.9)
Installing rake (10.1.1)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing hike (1.2.3)
Installing tilt (1.4.1)
Installing rack (1.4.5)
Installing mime-types (1.25.1)
Using bundler (1.5.2)
Installing polyglot (0.3.4)
Installing arel (3.0.3)
Installing coffee-script-source (1.7.0)
Installing execjs (2.0.2)
Installing thor (0.18.1)
Installing tzinfo (0.3.38)
Installing activesupport (3.2.16)
Installing rack-cache (1.2)
Installing sass (3.2.14)
Installing json (1.8.1)
Installing rack-test (0.6.2)
Installing sprockets (2.2.2)
Installing rack-ssl (1.3.3)
Installing coffee-script (2.2.0)
Installing uglifier (1.2.3)
Installing treetop (1.4.15)
Installing activemodel (3.2.16)
Installing mail (2.5.4)
Installing rdoc (3.12.2)
Installing activeresource (3.2.16)
Installing actionpack (3.2.16)
Installing activerecord (3.2.16)
Installing actionmailer (3.2.16)
Installing pg (0.12.2)
Installing railties (3.2.16)
Installing coffee-rails (3.2.2)
Installing rails (3.2.16)
Installing sass-rails (3.2.5)
Installing jquery-rails (2.0.2)
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 d
ata:
<= 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.67s)
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins!
Support for these plugins will be removed in Rails 4.0. Move them out and bundle
them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/
initializers/myplugin.rb. See the release notes for more on this: http://weblog.
rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (r
equired)> at /tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins!
Support for these plugins will be removed in Rails 4.0. Move them out and bundle
them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/
initializers/myplugin.rb. See the release notes for more on this: http://weblog.
rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (r
equired)> at /tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/Rakefile:7)
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapte
r.rb:1222:in `initialize'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapte
r.rb:1222:in `new'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapte
r.rb:1222:in `connect'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapte
r.rb:324:in `initialize'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapte
r.rb:28:in `new'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapte
r.rb:28:in `postgresql_connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:315:in `new_connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:325:in `checkout_new_connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:247:in `block (2 levels) in checkout'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:242:in `loop'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:242:in `block in checkout'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:239:in `checkout'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:102:in `block in connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:101:in `connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:410:in `retrieve_connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_specification.rb:171:in `retrieve_connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connecti
on_specification.rb:145:in `connection'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/model_schema.rb:310:in `clear_cache!'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activerecord-3.2.16/lib/active_record/railtie.rb:103:in `block (2 levels) i
n <class:Railtie>'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/callbacks.rb:418:in `_run__29092144
37341877339__prepare__337530506835694055__callbacks'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/callbacks.rb:405:in `__run_callback
'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/callbacks.rb:385:in `_run_prepare_c
allbacks'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/callbacks.rb:81:in `run_callbacks'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb:74:in `prepare
!'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb:48:in `prepare
!'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/application/finisher.rb:47:in `block in <module:F
inisher>'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/initializable.rb:30:in `run'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/initializable.rb:55:in `block in run_initializers
'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/initializable.rb:54:in `each'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/application.rb:136:in `initialize!'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/config/environment.rb:5:i
n `<top (required)>'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `block in re
quire'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_depend
ency'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/application.rb:103:in `require_environment!'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/railties-3.2.16/lib/rails/application.rb:305:in `block (2 levels) in initia
lize_tasks'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/actionpack-3.2.16/lib/sprockets/assets.rake:93:in `block (2 levels) in <top
(required)>'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/actionpack-3.2.16/lib/sprockets/assets.rake:60:in `block (3 levels) in <top
(required)>'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/actionpack-3.2.16/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_ta
sk'
/tmp/build_93b8a16e-fac8-4dff-bc73-1cffba455fbe/vendor/bundle/ruby/1.9.1/
gems/actionpack-3.2.16/lib/sprockets/assets.rake:29:in `block (2 levels) in <top
(required)>'
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:agile-springs-4943.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:agile-springs-4943.git'
这就是发生的事情。我的gemfile如下:
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.16'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
group :production do
gem 'pg', '0.12.2'
end
我试图在其他地方提出一些建议,但似乎都没有效果。我盲目地输入了heroku run rake db:create
和heroku run rake db:migrate
,两者都提供了错误rake aborted!
答案 0 :(得分:0)
听起来你可能没有添加Heroku Postgres附加组件。尝试从命令行运行heroku addons:add heroku-postgresql
或进入Heroku仪表板并从其GUI启用插件