2013-03-03 147 views
0

我目前通過Railstutorial持續和不斷得到當我運行heroku run rake db:migrate錯誤運行的Heroku運行耙分貝時:遷移

我已經在網上搜索了幾個小時的錯誤 - 錯誤似乎共同但有沒有一個提出的解決方案似乎有任何區別,你的幫助將非常感謝!

的錯誤是

Connecting to database specified by DATABASE_URL 
rake aborted! 
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) 

我跑gem install activerecord-postgresql-adapter和改變了我的Gemfile,現在看起來是這樣的:

group :development do 
    gem 'rspec-rails', '2.6.1' 
    gem 'sqlite3', '~> 1.3.0' 
end 

group :test do 
    gem 'rspec-rails', '2.6.1' 
    gem 'webrat', '0.7.1' 
    gem 'sqlite3', '~> 1.3.0' 
end 

group :production do 
    gem "pg" 
end 

犯我跑bundle install --without productiongit push heroku

我的database.yml後看起來像這樣:

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
development: 
    adapter: sqlite3 
    database: db/development.sqlite3 
    pool: 5 
    timeout: 5000 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: sqlite3 
    database: db/test.sqlite3 
    pool: 5 
    timeout: 5000 

production: 
    adapter: sqlite3 
    database: db/production.sqlite3 
    pool: 5 
    timeout: 5000 
+0

你有什麼你的database.yml文件? – 2013-03-03 17:30:43

+0

在原文中增加了database.yml – 2013-03-03 19:07:49

+0

取出你的gemfile中的生產組,並運行bundle install – 2013-03-03 19:23:40

回答

0

運行bundle install,然後推到Heroku的

略去--without production所以你Gemfile.lock的可以用寶石皮克得到具體化

+0

好吧,運行'bundle install','git push heroku','heroku run rake db:migrate' - 同樣的錯誤。我在某個地方錯過了一步嗎?運行捆綁軟件安裝之後的 – 2013-03-03 16:38:48

+0

,您是否使用git保存更改? 「git add。」然後「git commit -m」實現gemfile「」 – Alfonso 2013-03-03 16:45:33

+0

是的,我做到了。爲了確保我刪除了gemfile.lock,運行了'bundle install','git add .','git commit -am'並且被推送,仍然是同樣的錯誤。 – 2013-03-03 16:49:56

0

我已經使用Windows系統同樣的錯誤。嘗試在Ubunto虛擬機上,由於某種原因,錯誤消失了,因爲我能

+0

您能否留下完整的答案?也許完成最後一句話會有所幫助。 – Simon 2018-01-02 21:37:21

相關問題