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

安装Active Admin时报superclass mismatch for class StringIO (TypeError)错误

问题根因

superclass mismatch for class StringIO (TypeError)报错由 Ruby 2.5.8 与 bootsnap 1.9.1 版本不兼容 触发,同时可能伴随 Active Admin 版本与当前 Ruby/Rails 版本不匹配、权限组件重复引入的问题。

解决步骤
  • 先处理重复依赖问题:Gemfile 中不需要同时引入 cancancan 和 pundit 两个权限依赖,删除不需要的一个后执行 bundle install。
  • 降级 bootsnap 到兼容 Ruby 2.5 的版本:修改 Gemfile 中 bootsnap 的声明为
    gem 'bootsnap', '<= 1.8.1', require: false
    
    执行 bundle update bootsnap 完成版本更新。
  • 匹配 Active Admin 版本:如果你的 Rails 版本为 5.2 系列(对应 Ruby 2.5.x 版本),在 Gemfile 中指定 Active Admin 版本约束
    gem 'activeadmin', '~> 2.9'
    
    执行 bundle update activeadmin 更新。
  • 重新执行安装命令:
    rails g active_admin:install
    
    执行完成后运行 rails db:migrate 完成数据库迁移即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.27 11:15:07