【问题标题】:Bundler::GemRequireError and Gem Load Error is: AddDllDirectory failed when switching from Sqlite3 to PostgresBundler::GemRequireError 和 Gem 加载错误是:从 Sqlite3 切换到 Postgres 时 AddDllDirectory 失败
【发布时间】:2021-02-16 18:09:55
【问题描述】:

我有一个使用 SQLITE3 的 Rails 项目。我必须搬到 POSTGRES,因为 Heroku 需要这样做。

按照文档:https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres,这是我所做的:

  1. 更改了 Gemfile:

gem 'sqlite3'gem 'pg'

注意:我也试过gem 'pg', '~> 1.2', '>= 1.2.3'gem 'pg', '~> 1.2', '>= 1.2.2'。它们都返回相同的错误。

  1. 运行bundle install 没有错误
  2. 修改config/database.yml
default: &default
  adapter: postgresql
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: test_postgres

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: test_postgres

production:
  <<: *default
  database: test_postgres
  1. 根据文档,

一旦你安装了 pg gem 并迁移了你的 config/database.yml

我尝试了rails db:migrate,它返回了:

Bundler::GemRequireError: There was an error while trying to load the gem 'pg'.
Gem Load Error is: AddDllDirectory failed for D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/x64-mingw32
Backtrace for gem load error is:
...

注意:同样的错误显示在 rake db:migrate

rails s 打印出同样的错误:

D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:69:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'pg'. (Bundler::GemRequireError)
Gem Load Error is: AddDllDirectory failed for D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/x64-mingw32
Backtrace for gem load error is:
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:83:in `add_dll_directory_winapi'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:50:in `initialize'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in `new'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in `add_dll_directory'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:15:in `block in <main>'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:26:in `rescue in <main>'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:4:in `<main>'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:66:in `block (2 levels) in require'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `each'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `block in require'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `each'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `require'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler.rb:173:in `require'
D:/Fresqui/Documents/Programar/yale-citrus/config/application.rb:7:in `<main>'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `block in require'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:299:in `load_dependency'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `require'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:138:in `block in perform'
<internal:kernel>:90:in `tap'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:135:in `perform'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command/base.rb:69:in `perform'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command.rb:50:in `invoke'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands.rb:18:in `<main>'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:65:in `block (2 levels) in require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `each'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `block in require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `each'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler.rb:173:in `require'
        from D:/Fresqui/Documents/Programar/yale-citrus/config/application.rb:7:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `block in require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:299:in `load_dependency'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:138:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:135:in `perform'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command/base.rb:69:in `perform'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command.rb:50:in `invoke'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands.rb:18:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from bin/rails:4:in `<main>'
D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:83:in `add_dll_directory_winapi': AddDllDirectory failed for D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/x64-mingw32 (RubyInstaller::Runtime::DllDirectory::WinApiError)
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:50:in `initialize'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in `new'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in `add_dll_directory'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:15:in `block in <main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:26:in `rescue in <main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:4:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:66:in `block (2 levels) in require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `each'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `block in require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `each'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler.rb:173:in `require'
        from D:/Fresqui/Documents/Programar/yale-citrus/config/application.rb:7:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `block in require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:299:in `load_dependency'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:138:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:135:in `perform'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command/base.rb:69:in `perform'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command.rb:50:in `invoke'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands.rb:18:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from bin/rails:4:in `<main>'
D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': 126: The specified module could not be found.   - D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg_ext.so (LoadError)
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `block in require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:299:in `load_dependency'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:5:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:66:in `block (2 levels) in require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `each'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:61:in `block in require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `each'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler/runtime.rb:50:in `require'
        from D:/Ruby30-x64/lib/ruby/site_ruby/3.0.0/bundler.rb:173:in `require'
        from D:/Fresqui/Documents/Programar/yale-citrus/config/application.rb:7:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `block in require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:299:in `load_dependency'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.2/lib/active_support/dependencies.rb:332:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:138:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands/server/server_command.rb:135:in `perform'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command/base.rb:69:in `perform'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/command.rb:50:in `invoke'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.2/lib/rails/commands.rb:18:in `<main>'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from D:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from bin/rails:4:in `<main>'

我找不到任何关于该 gem 被弃用的信息,文档中没有任何内容,也没有多少帖子具有相同的错误。有什么线索吗?

【问题讨论】:

  • 如果需要,我可以提供更多信息

标签: ruby-on-rails postgresql rubygems


【解决方案1】:

这是link的原始答案,为每个 pacman 安装 postgresql:

  • ridk exec pacman -S mingw-w64-x86_64-postgresql
  • 重新安装pg gem gem install pg
  • 运行数据库设置脚本rails db:setup

【讨论】:

    猜你喜欢
    • 2016-03-28
    • 2016-05-31
    • 1970-01-01
    • 1970-01-01
    • 2016-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多