You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 7 64位系统下无法安装ffi gem的问题求助

Fixing the ffi Installation Error with Ruby 2.5.0

Hey there! I see you're just getting started with Cucumber and Ruby, and hit a snag installing the ffi gem—let's get this sorted out for you.

What's causing the error?

The core issue here is a version compatibility mismatch:

  • The error message tells you the last ffi version that supports your current RubyGems setup is 1.9.18, but ffi 1.9.18 requires Ruby versions between 2.0 and 2.4.x (strictly less than 2.5).
  • Your current Ruby version is 2.5.0, which falls outside that range—so installing 1.9.18 fails, and trying to install the latest ffi without specifying a version might be pulling up that incompatible old version by default for some reason.

Two ways to fix this:

1. Install a newer, Ruby 2.5-compatible version of ffi

Good news: Later versions of ffi (starting from 1.10.0) added support for Ruby 2.5.0. You can bypass the old incompatible version by explicitly installing a compatible one:

  • Run this command in your terminal:
    gem install ffi -v ">=1.10.0"
    
  • If you're using a Gemfile for your project, update the line for ffi to:
    gem 'ffi', '>=1.10.0'
    
    Then run bundle install to sync your dependencies.

2. Downgrade your Ruby version (if you need the old ffi version)

If your project has strict dependencies that require ffi 1.9.18, you'll need to switch to a Ruby version that works with it (2.0–2.4.x). Using a Ruby version manager like rbenv or RVM makes this easy:

  • For rbenv:
    1. Install Ruby 2.4.10 (the latest patch release of 2.4.x):
      rbenv install 2.4.10
      
    2. Set this version as the default for your project:
      rbenv local 2.4.10
      
    3. Now install the required ffi version:
      gem install ffi -v 1.9.18
      

Recommendation

Unless you have a specific reason to stick with ffi 1.9.18, go with option 1—it lets you keep your current Ruby 2.5.0 and get a fully supported version of ffi.

内容的提问来源于stack exchange,提问作者NateG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:17:57