当我在开发中使用PostgreSQL作为数据库时,使用heroku db:push命令出现了SQLite错误

12

我在将开发数据库中的数据推送到Heroku时遇到了问题。我决定将我的开发数据库切换到PostgreSQL,并更新了database.yml文件并从gemfiles中删除了sqlite gem。

应用程序可以针对PostgreSQL正常运行,但是当我尝试运行以下命令时:

heroku db:push

我遇到了一个SQLite错误,这让我感到困惑,因为我的项目中没有涉及到sqlite:

 !    Taps Load Error: cannot load such file -- sqlite3
 !    You may need to install or update the taps gem to use db commands.
 !    On most systems this will be:
 !    
 !    sudo gem install taps

这是我的database.yml文件:

development:
  adapter: postgresql
  encoding: unicode
  database: xxxx
  pool: 5
  timeout: 5000
  username: xxxx
  password: xxxx

test:
  adapter: postgresql
  encoding: unicode
  database: test
  pool: 5
  timeout: 5000
  username: xx
  password: xx

production:
  adapter: postgresql
  encoding: unicode
  database: test
  pool: 5
  timeout: 5000

我正在使用RVM,创建了一个新的gemset但没有成功。

我甚至尝试了这个方法,但还是遇到了相同的SQLite错误:

heroku db:push postgres://xx:xx@localhost/xx

 !    Taps Load Error: cannot load such file -- sqlite3
 !    You may need to install or update the taps gem to use db commands.
 !    On most systems this will be:
 !    
 !    sudo gem install taps

我也运行了bundle install和bundle update。

Johann

5个回答

10

我曾遇到同样的问题,通过将taps移到我的Gemfile中的开发组中解决了它 - taps需要sqlite,这就是导致问题的原因。

group :development do
  gem 'taps', :require => false # has an sqlite dependency, which heroku hates
end

尝试过了,但是出现了相同的错误(我运行了bundle install和update,并在推送db之前提交到heroku...出现了sqlite错误)。 - gugguson
9
解决了 - tekniklr的答案让我找对了方向。问题在于taps使用了sqlite,但客户端机器上没有安装它(我想我之前手动删除了它)。安装sqlite后,问题得到了解决。 - gugguson
3
我遇到了同样的问题。我认为这是家庭酿造程序的问题,因为我曾经手动安装过heroku,并同时使用homebrew来测试某些东西。'gem install sqlite3'解决了这个问题。 - dicato
Taps 不需要 sqlite3 运行时依赖。 - Vanuan
或许现在不再是这样了,但七个月前它确实是这样的 :) - tekniklr

8
解决方案是在:development组中添加tapssqlite3宝石。如果您已经在开发中使用了sqlite3,那么只添加taps宝石就足够了。但我在我的开发中使用的是mysql,所以为了解决这个问题,我不得不同时添加这两个宝石。
group :development do
  gem 'taps'
  gem 'sqlite3'
end

4
gem install sqlite3

这个问题对我来说已经解决了。


0
gem install sqlite3 

只需要这些。错误是本地产生的,而不是来自Heroku。


0
在我的Debian Wheezy上,我需要安装:
aptitude install libsqlite3-dev

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接