执行“heroku db:migrate”并收到错误“请安装 postgresql 适配器”

发布于 2024-12-11 04:47:04 字数 1363 浏览 0 评论 0原文

我正在尝试使用 mySQL 数据库执行 heroku db:migrate ,但收到错误/建议:

请安装 postgresql 适配器: gem install activerecord-postgresql-adapter (pg 不属于将其添加到 Gemfile 中。)

我尝试将“gem install activerecord-postgresql-adapter”放入我的 gem 文件中,但是当我运行捆绑安装时,我得到:

夏洛特-dator:showwwdown holgersindbaek$ 捆绑安装 /Users/holgersindbaek/Projekter/Showwwdown/showwwdown/Gemfile:34:in evaluate': 未定义的局部变量或方法activerecord' for # (NameError) 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb:17:in build' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:138:in定义' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:219:in install' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in发送' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in run' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/inspiration.rb:118:ininvoke_task' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in dispatch' 来自 /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:instart' 来自/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/bin/bundle:13 来自 /usr/bin/bundle:19:in `load' 来自 /usr/bin/bundle:19

希望你能帮忙。谢谢!

I'm trying to do a heroku db:migrate with my mySQL database and I'm getting the error/suggestion:

Please install the postgresql adapter: gem install activerecord-postgresql-adapter (pg is not part of the bundle. Add it to Gemfile.)

I try to put the "gem install activerecord-postgresql-adapter" in my gem-file, but when I run bundle install, I get:

charlotte-dator:showwwdown holgersindbaek$ bundle install
/Users/holgersindbaek/Projekter/Showwwdown/showwwdown/Gemfile:34:in evaluate': undefined local variable or methodactiverecord' for # (NameError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb:17:in build'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:138:in
definition'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:219:in install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in
send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in
invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in
start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19

Hope you can help. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

删除会话 2024-12-18 04:47:04

将以下行添加到您的 gemfile(相反):

gem 'pg'

如果您在开发中不使用 Postgres,您可以这样做:

gem 'pg', :group => :production

Add the following line to your gemfile (instead):

gem 'pg'

If you don't use Postgres in development, you can do this:

gem 'pg', :group => :production
北陌 2024-12-18 04:47:04

确保您推送到 heroku 的分支是 master 分支。

就我而言,我已经尝试了以上所有内容&它不起作用。当我推送 git 存储库时,我犯了另一个错误,我没有推送 master 分支,而是推送了另一个“命名”分支。因此,即使更新 gem 文件等后,我的更改也没有得到反映。

Make sure the branch you are pushing to heroku is master branch.

In my case i had tried all above & it was not working. I had done another mistake when i pushed my git repository i didn't push master branch but instead another 'named' branch. So my changes were not getting reflected even after updating gem file etc .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文