2015-06-15 19 views
0

我正在嘗試在heroku上創建我的應用的臨時實例。無法在heroku上創建臨時實例

雖然我做git push staging master

我越來越

remote: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

並在此之後我得到與捆綁的問題,它說

An error occurred while installing sqlite3 (1.3.10), and Bundler cannot remote: continue. remote: Make sure that gem install sqlite3 -v '1.3.10' succeeds before bundling. remote: ! remote: ! Failed to install gems via Bundler.

我已經安裝了sqlite的寶石,和我手動安裝它,我仍然得到相同的錯誤。

請幫忙。

回答

1

在你的Gemfile

group :production do 
    gem 'pg', '0.17.1' 
    gem 'rails_12factor', '0.0.2’ 
end 

,也拆除寶石 'sqlite3的' OR

group :development, :test do 
    gem 'sqlite3' 
end 

因爲Heroku上無法安裝sqlite3的寶石。但是你可以告訴打包者,除了開發時,它不應該嘗試。

然後運行bundle install並嘗試在Heroku上進行部署。

+0

SQLite在內存中運行,並將其數據存儲備份到磁盤上的文件中。雖然這個策略對於開發很有效,但Heroku的Cedar棧有一個短暫的文件系統。您可以寫信給它,並且可以從中讀取,但內容將被定期清除。如果您要在Heroku上使用SQLite,您將每24小時至少丟失一次整個數據庫。 –

+0

https://devcenter.heroku.com/articles/sqlite3請參閱此鏈接 –

1

Heroku不支持sqlite3數據庫,所以你不能在Heroku環境下安裝sqlite3 gem。如this article所述,Heroku建議使用Postgresql作爲生產數據庫。

所以,你需要做的就是按照該文章中的說明,用pg gem替換你的sqlite3 gem,然後做一些數據庫配置。