我正在使用sqlite3开发一个rails应用程序。我想把它推给Heroku。在Heroku教程中,它说我必须首先改变:
gem 'sqlite3'至
gem 'pg'然后运行
bundle install我得到了这个错误:
Installing pg (0.14.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
...接下来,我尝试了提出的解决方案here
running gem install pg -- --with-pg-config= /usr/bin/pg_config我还试着跑:
sudo apt-get install postgresql
sudo apt-get install libpq-dev和
gem install pg工作正常..
但
bundle install仍然会给我同样的错误
注意:我使用的是rvm
发布于 2012-12-08 04:07:40
你试过了吗
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end这样你就可以在开发中使用sqlite,当你推送heroku作为产品时,它将是pg。
发布于 2012-12-08 04:12:39
将您的gemfile更改为以下内容:
gem 'sqlite3', :group => :development
gem 'pg', :group => :production这样,您将在开发中本地使用SQL。Heroku将忽略sqlite gem,转而使用Postgres。
https://stackoverflow.com/questions/13769715
复制相似问题