Ruby/Rails环境下无法加载ffi文件的LoadError问题求助
求助:Ruby环境下仅ffi的LoadError问题
我在互联网及Stack Overflow上找到的都是针对ffi_c的C可执行文件错误解决方案,但我遇到的是仅ffi的LoadError。此前该问题就出现过,切换到WSL并通过ASDF多版本管理器将Ruby从3.3.0升级到3.3.3后,问题再次出现。原本以为升级Ruby和Rails版本能解决,但并未奏效。运行服务器、预编译资源或安装部分gem时都会触发该错误。
我已尝试以下方案,但问题仍未解决:
- 重新安装带DevKit的Ruby
- 更换项目目录
- 在Gemfile中添加ffi并执行
bundle install - 直接执行
gem install ffi
错误堆栈信息如下:
C:/Ruby33-x64/bin/ruby.exe -x C:\Ruby33-x64\bin\bundle exec C:\Ruby33-x64\bin\ruby.exe D:/Learning/Language_Tools_and_learning/RailsPractice/untitled/bin/rails server -b 127.0.0.1 -p 3000 -e development C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- ffi (LoadError) from C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27:in `require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/zeitwerk-2.6.16/lib/zeitwerk/kernel.rb:34:in `require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `<main>' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `require_relative' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `<main>' from <internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require' from <internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require' from C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/zeitwerk-2.6.16/lib/zeitwerk/kernel.rb:34:in `require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/runtime.rb:60:in `block (2 levels) in require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/runtime.rb:55:in `each' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/runtime.rb:55:in `block in require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/runtime.rb:44:in `each' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/runtime.rb:44:in `require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler.rb:212:in `require' from D:/Learning/Language_Tools_and_learning/RailsPractice/untitled/config/application.rb:19:in `<main>' from C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' from C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/commands/server/server_command.rb:139:in `block in perform' from <internal:kernel>:90:in `tap' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/commands/server/server_command.rb:136:in `perform' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/command/base.rb:178:in `invoke_command' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/command/base.rb:73:in `perform' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/command.rb:71:in `block in invoke' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/command.rb:149:in `with_argv' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/command.rb:69:in `invoke' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/railties-7.2.0.beta2/lib/rails/commands.rb:18:in `<main>' from C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' from C:/Ruby33-x64/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from C:/Users/XYZ/.gem/ruby/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' from D:/Learning/Language_Tools_and_learning/RailsPractice/untitled/bin/rails:4:in `<main>' Process finished with exit code 1
内容的提问来源于stack exchange,提问作者UUC110
相关产品推荐
相关产品推荐

