In a Rails application, with a bare pg
requirement in your Gemfile:
在Rails应用程序中,Gemfile中有一个简单的pg要求:
gem 'pg'
You'll get the following error:
您将收到以下错误:
Gem::LoadError can't activate pg (~> 0.18), already activated pg-1.0.0. Make sure all dependencies are added to Gemfile.
1 个解决方案
#1
41
The pg
gem recently released version 1.0.0
which is not yet compatible with Rails.
pg gem最近发布了1.0.0版本,它还与Rails不兼容。
If you're on Rails 5, change your Gemfile's pg
requirement to the following1:
如果您使用的是Rails 5,请将Gemfile的pg要求更改为以下1:
gem 'pg', '~> 0.18'
or on Rails < 5, this:
或者在Rails <5上,这个:
gem 'pg', '~> 0.11'
And then run
然后跑
bundle update pg
1 Bundler will effectively do the exact same thing with either line, but this way you'll match the Rails source code's runtime check exactly, as well as the version emitted by
rails new
's Gemfile generator.
#1
41
The pg
gem recently released version 1.0.0
which is not yet compatible with Rails.
pg gem最近发布了1.0.0版本,它还与Rails不兼容。
If you're on Rails 5, change your Gemfile's pg
requirement to the following1:
如果您使用的是Rails 5,请将Gemfile的pg要求更改为以下1:
gem 'pg', '~> 0.18'
or on Rails < 5, this:
或者在Rails <5上,这个:
gem 'pg', '~> 0.11'
And then run
然后跑
bundle update pg
1 Bundler will effectively do the exact same thing with either line, but this way you'll match the Rails source code's runtime check exactly, as well as the version emitted by
rails new
's Gemfile generator.