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

求助:安装json (1.8.0)失败致Bundler终止,Ruby gems问题如何解决?

Fixing json 1.8.0 Gem Installation Failures

Hey there, let's work through this json 1.8.0 gem install issue—old gems like this often clash with modern system setups, but we've got a few fixes to try:

1. Verify Ruby Version Compatibility

json 1.8.0 is a legacy gem that doesn't play nice with Ruby versions newer than 2.4.x. First, check your current Ruby version with:

ruby -v

If you're running Ruby 2.5 or later, use a version manager like rbenv or rvm to switch to a compatible version (e.g., Ruby 2.3.8). For example, with rbenv:

rbenv install 2.3.8
rbenv local 2.3.8

2. Install System Dependencies for Compilation

The json gem requires native compilation tools and libraries. Install them based on your OS:

  • Ubuntu/Debian:
    sudo apt-get update && sudo apt-get install build-essential libssl-dev
    
  • macOS:
    Install Xcode Command Line Tools (if not already installed):
    xcode-select --install
    
    If you're using a newer macOS version, you might need to link to an older OpenSSL version (json 1.8.0 doesn't support OpenSSL 3). Use Homebrew to install OpenSSL 1.1 and specify it during gem install:
    brew install openssl@1.1
    gem install json -v '1.8.0' -- --with-openssl-dir=$(brew --prefix openssl@1.1)
    

3. Clear Corrupted Gem Cache

Sometimes a corrupted cache can block installation. Clean up the json gem cache and try again:

gem cleanup json
gem install json -v '1.8.0'

4. Configure Bundler to Use Correct Build Flags

If you're using Bundler, set the build configuration for the json gem to ensure it uses the right libraries:

bundle config build.json --with-openssl-dir=$(brew --prefix openssl@1.1) # macOS example
# For Ubuntu/Debian, if needed: bundle config build.json --with-openssl-dir=/usr/lib/ssl

Then run:

bundle install

If none of these steps work, share the full error output you get when running gem install json -v '1.8.0'—that will help pinpoint the exact issue (like missing libraries or Ruby version mismatches).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 09:38:30