Saturday, October 10, 2015

Ruby cannot load such file -- 2.2/pg_ext (LoadError) 에러 해결 방법

윈도우에 Ruby on Rails를 설치하여 빌드하여 실행 하려고 하는데(rails s) 다음과 같은 에러가 발생했다.

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `require': cannot load such file -- 2.2/pg_ext (LoadError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `rescue in <top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
        from C:/git/amanda-api/config/application.rb:7:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `block in server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

이를 해결하는 방법은 다음과 같다.
gem instasll pg --pre
gem list pg

확인결과 최신버전은 0.18.3이다.
그럼 Gemfile, Gemfile.lock에서 pg의 버전을 0.18.3으로 변경하면 해결 된다.

No comments:

Post a Comment