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