简体   繁体   中英

Rails App errors after pg gem update

I updated the pg gem for my database to the 1.0.0 version and am now having issues. I am trying to revert to the previous version, but am still getting errors. Anyone else having this same issue?

Gemfile

# Use postgresql as the database for Active Record
gem 'pg', '~> 0.21.0'

Error when I run rake db:migrate

dyld: lazy symbol binding failed: Symbol not found: _rb_fd_init
  Referenced from: /Users/topher/.rvm/gems/ruby-2.5.0/gems/pg-0.21.0/lib/pg_ext.bundle
  Expected in: flat namespace

No error when I run rails s

When I change my Gemfile to the newest version of the pg gem I get these errors:

Gemfile

# Use postgresql as the database for Active Record
gem 'pg', '~> 1.0.0'

Error when I run rake db:migrate

rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, 
     but the gem is not loaded. Add `gem 'pg'` to your Gemfile 
     (and ensure its version is at the minimum required by 
     ActiveRecord).

Error when I run rails s

Specified 'postgresql' for database adapter, but the gem is not 
    loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is 
    at the minimum required by ActiveRecord). (Gem::LoadError)

Anyone else run into this issue and have a fix?

After looking into the issue a little bit further and with something that @MartinZinovsky stated in a comment, I wondered if it wasn't an issue with the pg gem, but with another gem not being updated, specifically ActiveRecord. This is the part of the error that got me thinking as it was showing up in both errors:

ensure its version is at the minimum required by ActiveRecord

So, instead of doing bundle update pg as Martin suggested, I did bundle update for it to go through and update all gems that had available updates. When doing this, it did in fact update all of the 'action' and 'active' gems to a newer version, along with the 'activerecord' gem. This has seemed to solve the issues. Now rake db:migrate works and so does rails s . Here is the output after I ran bundle update in case someone else runs into this issue and it is not ActiveRecord only that needed to be updated. Maybe you can use this list to see what else updated on my end to track down why it isn't working for you:

After running bundle update

$ bundle update
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.....
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Using i18n 0.9.5 (was 0.9.3)
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5 (was 1.2.4)
Using activesupport 5.1.5 (was 5.1.4)
Using builder 3.2.3
Fetching erubi 1.7.1 (was 1.7.0)
Installing erubi 1.7.1 (was 1.7.0)
Using mini_portile2 2.3.0
Using nokogiri 1.8.2
Using rails-dom-testing 2.0.3
Using crass 1.0.3
Using loofah 2.2.0 (was 2.1.1)
Using rails-html-sanitizer 1.0.3
Using actionview 5.1.5 (was 5.1.4)
Using rack 2.0.4
Using rack-test 0.8.3 (was 0.8.2)
Using actionpack 5.1.5 (was 5.1.4)
Using nio4r 2.2.0
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.5 (was 5.1.4)
Using globalid 0.4.1
Using activejob 5.1.5 (was 5.1.4)
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.1.5 (was 5.1.4)
Using activemodel 5.1.5 (was 5.1.4)
Using arel 8.0.0
Using activerecord 5.1.5 (was 5.1.4)
Using bundler 1.16.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.1.5 (was 5.1.4)
Using sprockets 3.7.1
Using sprockets-rails 3.2.1
Using rails 5.1.5 (was 5.1.4)
Using actionview-encoded_mail_to 1.0.9
Using public_suffix 3.0.2 (was 3.0.1)
Using addressable 2.5.2
Using execjs 2.7.0
Fetching autoprefixer-rails 8.1.0.1 (was 7.2.5)
Installing autoprefixer-rails 8.1.0.1 (was 7.2.5)
Fetching aws-partitions 1.70.0 (was 1.61.0)
Installing aws-partitions 1.70.0 (was 1.61.0)
Using aws-sigv4 1.0.2
Using jmespath 1.3.1
Fetching aws-sdk-core 3.17.0 (was 3.15.0)
Installing aws-sdk-core 3.17.0 (was 3.15.0)
Using aws-sdk-kms 1.5.0
Fetching aws-sdk-s3 1.8.2 (was 1.8.0)
Installing aws-sdk-s3 1.8.2 (was 1.8.0)
Using bcrypt 3.1.11
Using bindex 0.5.0
Using popper_js 1.12.9
Using rb-fsevent 0.10.3 (was 0.10.2)
Using ffi 1.9.23 (was 1.9.18)
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.5
Using bootstrap 4.0.0
Using bootstrap-table-rails 1.11.1.1
Using uniform_notifier 1.11.0
Fetching bullet 5.7.4 (was 5.7.2)
Installing bullet 5.7.4 (was 5.7.2)
Using byebug 10.0.0
Using xpath 3.0.0
Using capybara 2.18.0 (was 2.17.0)
Using mime-types-data 3.2016.0521
Using mime-types 3.1
Using carrierwave 1.2.2
Using carrierwave-aws 1.3.0
Fetching childprocess 0.9.0 (was 0.8.0)
Installing childprocess 0.9.0 (was 0.8.0)
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using coffee-rails 4.2.2
Using orm_adapter 0.5.0
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.4.1
Using unf_ext 0.0.7.5
Using unf 0.1.4
Using domain_name 0.5.20170404
Using dotenv 2.2.1
Using dotenv-rails 2.2.1
Using font-awesome-rails 4.7.0.3
Using http-cookie 1.0.3
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.1
Using jquery-ui-rails 6.0.1
Using json 2.1.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Using mini_magick 4.8.0
Using netrc 0.11.0
Using pg 1.0.0
Fetching puma 3.11.3 (was 3.11.2)
Installing puma 3.11.3 (was 3.11.2) with native extensions
Fetching recaptcha 4.6.6 (was 4.6.5)
Installing recaptcha 4.6.6 (was 4.6.5)
Using redcarpet 2.3.0
Using rest-client 2.0.2
Using rubyzip 1.2.1
Using tilt 2.0.8
Using sass-rails 5.0.7
Using selenium-webdriver 3.10.0 (was 3.8.0)
Using spring 2.0.2
Using spring-watcher-listen 2.0.1
Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Fetching uglifier 4.1.7 (was 4.1.5)
Installing uglifier 4.1.7 (was 4.1.5)
Using web-console 3.5.1
Bundle updated!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM