如何解决Rails 生成设备安装问题LoadError 文件
当我在 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
解决方法
堆栈跟踪似乎表明您没有在目标机器上安装 PostgreSQL 库。因此,要解决该问题,您可以下载软件 here 的稳定版本,并确保在安装过程中检查了开发库。这将要求您在安装后关闭并重新打开所有活动的 cmd 会话。
之后,在 Rails 项目上重新运行 File "app.py",line 6,in <module>
import tendie_dashboard
File "C:\Users\Maithri\Desktop\Mini Project\Tendie-Tracker-master\tendie_dashboard.py",line 3,in <module>
import tendie_budgets
File "C:\Users\Maithri\Desktop\Mini Project\Tendie-Tracker-master\tendie_budgets.py",in <module>
import tendie_categories
File "C:\Users\Maithri\Desktop\Mini Project\Tendie-Tracker-master\tendie_categories.py",line 10,in <module>
engine = create_engine(os.getenv("DATABASE_URL"))
File "C:\Users\Maithri\Desktop\Mini Project\Tendie-Tracker-master\env\lib\site-packages\sqlalchemy\engine\__init__.py",line 479,in create_engine
return strategy.create(*args,**kwargs)
File "C:\Users\Maithri\Desktop\Mini Project\Tendie-Tracker-master\env\lib\site-packages\sqlalchemy\engine\strategies.py",line 56,in create
plugins = u._instantiate_plugins(kwargs)
AttributeError: 'NoneType' object has no attribute '_instantiate_plugins'
(如果您使用的 bundler 早于 2.1)或 bundle install --force
(如果您使用的是 Bundler 2.1 或更高版本),并且应该能够正确编译和运行。
如果它已安装并且不能使用上述选项,请通过执行 bundle install --redownload
重新安装 gem 或使用预发布版本(在开发机器上)通过 gem install pg -f
来查看无论他们能否解决您的问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。