执行“heroku db:migrate”并收到错误“请安装 postgresql 适配器”
我正在尝试使用 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:in
invoke_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:in
start' 来自/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 method
activerecord' for # (NameError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb:17:in build'
definition'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:138:in
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:219:in install'
send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in run'
invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in dispatch'
start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将以下行添加到您的 gemfile(相反):
如果您在开发中不使用 Postgres,您可以这样做:
Add the following line to your gemfile (instead):
If you don't use Postgres in development, you can do this:
确保您推送到 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 .