gpt4 book ai didi

ruby-on-rails - 如何解决 "LoadError: cannot load such file -- 2.5/ffi_c"Running Ruby on Rails with WSL

转载 作者:行者123 更新时间:2023-12-05 05:54:03 26 4
gpt4 key购买 nike

我正在尝试使用适用于 Linux 的 Windows 子系统 (WSL) 在我的 Windows 机器上启动并运行一个(私有(private))Ruby on Rails 应用程序。我能够在没有任何错误的情况下运行 bundle install 但现在当我运行 rails apartment:create 时出现错误:

LoadError:libffi.so.8:无法打开共享对象文件:没有这样的文件或目录 -/home/myDirectory/.rvm/gems/ruby-2.5.7/gems/ffi-1.11.1/lib/ffi_c .so

完整错误如下。

我尝试使用 rvm get headrvm reinstall 2.5.7 重新安装 ruby​​,使用 gem uninstall ffigem 重新安装 ffi安装 ffi -v 1.11.1,并使用 ln -s libffi.so.8 libffi.so.1.8 创建符号链接(symbolic link),但得到相同的结果。

我看到引用的文件在那里: enter image description here

还有什么我可以尝试的吗?

me@LAPTOP-xyz:/mnt/c/Users/me/Documents/app/Application/master$ rails apartment:create
rails aborted!
LoadError: libffi.so.8: cannot open shared object file: No such file or directory - /home/me/.rvm/gems/ruby-2.5.7/gems/ffi-1.11.1/lib/ffi_c.so
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/home/me/.rvm/gems/ruby-2.5.7/gems/ffi-1.11.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/ffi-1.11.1/lib/ffi.rb:3:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/config/application.rb:18:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/rakefile:4:in `require_relative'
/mnt/c/Users/me/Documents/app/Application/master/rakefile:4:in `<top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:22:in `block in perform'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/bin/rails:9:in `require'
/mnt/c/Users/me/Documents/app/Application/master/bin/rails:9:in `<top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/bin/spring:15:in `require'
/mnt/c/Users/me/Documents/app/Application/master/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
LoadError: cannot load such file -- 2.5/ffi_c
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/me/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/home/me/.rvm/gems/ruby-2.5.7/gems/ffi-1.11.1/lib/ffi.rb:4:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/config/application.rb:18:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/rakefile:4:in `require_relative'
/mnt/c/Users/me/Documents/app/Application/master/rakefile:4:in `<top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:22:in `block in perform'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/home/me/.rvm/gems/ruby-2.5.7/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/bin/rails:9:in `require'
/mnt/c/Users/me/Documents/app/Application/master/bin/rails:9:in `<top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/me/.rvm/gems/ruby-2.5.7/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/mnt/c/Users/me/Documents/app/Application/master/bin/spring:15:in `require'
/mnt/c/Users/me/Documents/app/Application/master/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)

最佳答案

我不确定您当前的设置是什么,但我最近遇到了与 WSL 错误类似的问题。

对于,我认为问题是在我通过 Homebrew for Linux 安装 ffmpeg 时出现的。在执行 brew install ffmpeg 时,我相信它添加了一个 brew install ffi 作为其依赖项的结果,导致我的系统上的某些东西随着关于 FFI。

在重新安装(通过 rbenv)几次都无济于事之后,我终于做了一个 brew uninstall ffi --ignore-dependencies 然后做了另一个rbenv 安装 2.7.4

在此之后,我能够成功地 gem install llhttp-ffi -v 0.4.0 而我之前无法做到,因为您收到的错误消息相同。

抱歉,除了与您有相同的错误外,没有任何其他细节。希望您能指出正确的方向。

关于ruby-on-rails - 如何解决 "LoadError: cannot load such file -- 2.5/ffi_c"Running Ruby on Rails with WSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69740540/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com