当需要ruby 3.0中的pg时,获取“找不到指定模块”

lg40wkob  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(183)

我已经用各自的安装程序安装了最新版本的ruby和postgre。
具体版本如下:
ruby 3.0.2和devkit,来自:https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-3.0.2-1/rubyinstaller-devkit-3.0.2-1-x64.exe
postgresql 13.3来自:https://www.enterprisedb.com/postgresql-tutorial-resources-training?cid=437 (这是官方页面指向的版本)。
我安装了postgre gem,包括: gem install pg -- --with-pg-dir="C:\path\to\PostGre" 成功安装了pg-1.2.3 gem。
但当我这么做的时候 require 'pg' 在irb中,我收到一条错误消息:

C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:83:in 'add_dll_directory_winapi': AddDllDirectory failed for C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/x64-mingw32 (RubyInstaller::Runtime::DllDirectory::WinApiError)
        from C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:50:in 'initialize'
        from C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in 'new'
        from C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in 'add_dll_directory'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:15:in 'block in <top (required)>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:26:in 'rescue in <top (required)>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:4:in '<top (required)>'
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in 'require'
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in 'rescue in require'
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in 'require'
        from (irb):1:in '<main>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/irb-1.3.5/exe/irb:11:in '<top (required)>'
        from C:/Ruby30-x64/bin/irb.cmd:31:in 'load'
        from C:/Ruby30-x64/bin/irb.cmd:31:in '<main>'
<internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in 'require': 126: Le module spécifié est introuvable.   
- C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg_ext.so (LoadError)
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in 'require'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:5:in '<top (required)>'
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in 'require'
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in 'rescue in require'
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in 'require'
        from (irb):1:in `<main>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/irb-1.3.5/exe/irb:11:in '<top (required)>'
        from C:/Ruby30-x64/bin/irb.cmd:31:in `load'
        from C:/Ruby30-x64/bin/irb.cmd:31:in `<main>'
<internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in 'require': cannot load such file -- pg (LoadError)
        from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in 'require'
        from (irb):1:in '<main>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/irb-1.3.5/exe/irb:11:in '<top (required)>'
        from C:/Ruby30-x64/bin/irb.cmd:31:in 'load'
        from C:/Ruby30-x64/bin/irb.cmd:31:in '<main>'

主要错误似乎是“找不到指定的模块”(这里是法语,抱歉)。我怎样才能解决这个问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题