Search code examples
ruby-on-railsrubyruby-on-rails-3ruby-on-rails-4rubygems

Could not find gem 'pg x64-mingw32' in locally installed gems


Please help me get rid of this error

I am running Ruby on Rails on Windows 10

Could not find gem 'pg x64-mingw32' in locally installed gems.enter image description here


Solution

  • This happens, if pg gem is installed with a dedicated PostgreSQL installation. they will update the pg gem soon to fix this and to distribute ruby-3.0 compatible binary gems, but until then there are 3 workarounds:

     1. install postgresql per pacman: ridk exec pacman -S
        mingw-w64-x86_64-postgresql and reinstall pg gem 
     2. Set RUBY_DLL_PATH=<your-path-to-postgresql>/bin as in our CI (https://github.com/ged/ruby-pg/blob/4de2c7df34b23a23841b114ae6606161be44d269/appveyor.yml#L22) before
        running the ruby app. 
     3. Downgrade to ruby < 3.0, since that installs
        the binary windows gems instead.
    

    For more info check Github issue.