gpt4 book ai didi

ruby-on-rails - 安装rbenv时如何解决gem依赖?

转载 作者:行者123 更新时间:2023-12-04 05:43:57 25 4
gpt4 key购买 nike

最近我安装了 rbenv 并将 ruby​​ 指定为 2.3.1 并将 rails 指定为 5.1.1 但我无法运行我的项目,因为我得到:

Ignoring json-2.1.0 because its extensions are not built.  Try: gem pristine json --version 2.1.0
Ignoring nokogiri-1.8.1 because its extensions are not built. Try: gem pristine nokogiri --version 1.8.1
Ignoring unf_ext-0.0.7.4 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.4
Ignoring yajl-ruby-1.3.1 because its extensions are not built. Try: gem pristine yajl-ruby --version 1.3.1
/var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find unf_ext-0.0.7.4 in any of the sources (Bundler::GemNotFound)

from /var/lib/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
...
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/bin/spring:49:in `<main>'

我跑了:

bundle install

安装成功,但是...现在我得到:

/home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/lib/ffi.rb:6:in `require': incompatible library version - /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/lib/ffi_c.so (LoadError)
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/lib/ffi.rb:6:in `rescue in <top (required)>'
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/lib/ffi.rb:3:in `<top (required)>'
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/rb-inotify-0.9.8/lib/rb-inotify/native.rb:1:in `require'
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/rb-inotify-0.9.8/lib/rb-inotify/native.rb:1:in `<top (required)>'
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/rb-inotify-0.9.8/lib/rb-inotify.rb:1:in `require'
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/rb-inotify-0.9.8/lib/rb-inotify.rb:1:in `<top (required)>'
from /home/alex/pnv/vendor/bundle/ruby/2.3.0/gems/listen-3.0.8/lib
...
from /home/alex/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'

我不知道如何解决这个问题。感谢您的帮助!

更新 1:最后,我找到了这个邪恶错误的来源——尽管如此,我指定了 Rails 5.1.1,当我运行 rails new app_name 时,它​​安装了 5.1.6!似乎它使用 5.1.6 gem 依赖项...仍然不知道如何解决而不是升级到 >= 5.1.6

最佳答案

将以下行添加到您的 Gemfile。

gem 'rails', '5.1.1'

运行 bundle install

关于ruby-on-rails - 安装rbenv时如何解决gem依赖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50271805/

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