【问题标题】:Rails generate devise install problem (LoadError files)Rails 生成设计安装问题(LoadError 文件)
【发布时间】:2021-08-12 03:30:12
【问题描述】:

当我在 cmd 中运行此命令时 - rails generate devise:install

我遇到了这个问题

C:\Users\Andrew\instagram-clone>rails generate devise:install
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- 3.0/pg_ext (LoadError)
Did you mean?  3.0.0/devkit
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `block in require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-0.18.4-x64-mingw32/lib/pg.rb:14:in `rescue in <main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-0.18.4-x64-mingw32/lib/pg.rb:3:in `<main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:61:in `each'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:61:in `block in require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:50:in `each'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:50:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler.rb:173:in `require'
    from C:/Users/Andrew/instagram-clone/config/application.rb:7:in `<main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command/actions.rb:22:in `require_application!'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/commands/generate/generate_command.rb:21:in `perform'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command/base.rb:69:in `perform'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command.rb:50:in `invoke'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from bin/rails:4:in `<main>'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- pg_ext (LoadError)
C:\Users\Andrew\instagram-clone>rails generate devise:install
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- 3.0/pg_ext (LoadError)
Did you mean?  3.0.0/devkit
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `block in require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-0.18.4-x64-mingw32/lib/pg.rb:14:in `rescue in <main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/pg-0.18.4-x64-mingw32/lib/pg.rb:3:in `<main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:61:in `each'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:61:in `block in require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:50:in `each'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/runtime.rb:50:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler.rb:173:in `require'
    from C:/Users/Andrew/instagram-clone/config/application.rb:7:in `<main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command/actions.rb:22:in `require_application!'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/commands/generate/generate_command.rb:21:in `perform'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command/base.rb:69:in `perform'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/command.rb:50:in `invoke'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from bin/rails:4:in `<main>'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- pg_ext (LoadError)

也许 smb 有同样的错误? 将非常感谢回答Thx

【问题讨论】:

  • 不确定是什么问题,但我会从跟踪中搜索“无法加载此类文件 -- pg_ext”的解决方案

标签: ruby-on-rails ruby devise rubygems


【解决方案1】:

堆栈跟踪似乎表明您没有在目标计算机上安装 PostgreSQL 库。因此,要解决这个问题,您可以下载软件的稳定版本here,并确保在设置过程中检查了开发库。这将要求您在安装后关闭并重新打开所有活动的 cmd 会话。

之后,在 Rails 项目上重新运行bundle install --force(如果您使用的是早于 2.1 的捆绑程序)或bundle install --redownload(如果您使用的是 Bundler 2.1 或更高版本),应该能够正确编译和运行.

如果已安装并且无法使用上述选项,请通过 gem install pg -f 重新安装 gem 或使用 gem install pg --pre 的预发布版本(在开发机器上)查看它们是否可以或可能无法解决您的问题。

【讨论】:

    猜你喜欢
    • 2013-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多