Ruby/PgSQL error on Rails start : cannot load such file — pg_ext (LoadError)

后端 未结 5 1839
死守一世寂寞
死守一世寂寞 2020-12-19 05:04

I\'m new to Ruby (coming from a Java background) and was given access to a RoR project from a Git repository. I was able to get Ruby built with rbenv and Postgres installed

相关标签:
5条回答
  • 2020-12-19 05:23

    I'm curious if you installed the pg gem before or after installing postgres via brew?

    If pg was installed before you installed Postgres via brew, you may need to remove it and install it again so that it's compiled against your current version of Postgres.

    Side note: postgresapp is a much better alternative to installing postgres via homebrew: http://postgresapp.com/

    0 讨论(0)
  • 2020-12-19 05:27

    Issue also appears in Fedora 17.

    Uninstall "pg" gem:

    gem uninstall pg
    

    Run bundle (assuming Gemfile contains "pg" gem):

    bundle
    
    0 讨论(0)
  • 2020-12-19 05:46

    Add the pg gem to your Gemfile. Then run:

    bundle install
    bundle update
    
    0 讨论(0)
  • 2020-12-19 05:47

    I've already installed the pg gem list pg

    I also encountered this problem and I made it work. First, you run the command: $ gem install pg --pre
    Successfully installed pg-0.21.0-x64-mingw32

    Next, you update your Gemfile: gem 'pg', '~> 0.21.0'. That's it.

    My rubygems environment are as follow:

    RubyGems Environment:
      - RUBYGEMS VERSION: 2.6.12
      - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x64-mingw32]
      - INSTALLATION DIRECTORY: C:/Ruby23-x64/lib/ruby/gems/2.3.0
      - USER INSTALLATION DIRECTORY: C:/Users/armano/.gem/ruby/2.3.0
      - RUBY EXECUTABLE: C:/Ruby23-x64/bin/ruby.exe
      - EXECUTABLE DIRECTORY: C:/Ruby23-x64/bin
      - SPEC CACHE DIRECTORY: C:/Users/armano/.gem/specs
      - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
      - RUBYGEMS PLATFORMS:
        - ruby
        - x64-mingw32
      - GEM PATHS:
         - C:/Ruby23-x64/lib/ruby/gems/2.3.0
         - C:/Users/armano/.gem/ruby/2.3.0
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :backtrace => false
         - :bulk_threshold => 1000
         - "gem" => "--no-ri --no-rdoc"
      - REMOTE SOURCES:
         - https://rubygems.org/
    
    0 讨论(0)
  • 2020-12-19 05:48

    If during the installation of the gem the pq installation is not in path so it could not be found by the gem. Than the gem would not work correct.

    • Check the path (try to start psql from commandline).
    • uninstall the pg-gem: gem unistall pg
    • and reinstall it: bundle install or gem install pg
    0 讨论(0)
提交回复
热议问题