Ruby gem 'pg' 报错:Gem::LoadError can't activate pg (~> 0.18), already activated pg-1.0.0. Make sure all dependencies are added to Gemfile.
在一个Rails应用里,GemFile配置postgres依赖
gem 'pg'
报错:
Gem::LoadError can't activate pg (~> 0.18), already activated pg-1.0.0. Make sure all dependencies are added to Gemfile.
报这个错误的原因是pg-1.0.0与Rails 5不兼容。
解决方法
Rails 5,Gemfile修改如下:
gem 'pg', '~> 0.18'
Rails < 5
gem 'pg', '~> 0.11'
修改后,更新一下依赖的包
bundle update pg
转载注明:文章转载自 码经笔记 [https://majing.io]
本文链接:https://majing.io/posts/10000006181197
版权声明:著作权归作者所有。
网友评论