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

执行rails server命令报错:bootsnap相关Errno::ENOENT问题求助

Rails启动报错:Errno::ENOENT (No such file or directory - bs_fetch:open_current_file:open)

问题场景

在路径D:\Сайты\ruby\lr5下创建Ruby on Rails项目,执行rails server命令时触发如下错误:

C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/compile_cache/iseq.rb:60:in `fetch': No such file or directory - bs_fetch:open_current_file:open (Errno::ENOENT)
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/compile_cache/iseq.rb:60:in `fetch'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/compile_cache/iseq.rb:85:in `load_iseq'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:137:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from bin/rails:4:in `<main>'

已尝试操作

卸载并手动重装bootsnap gem,问题未解决。

环境信息

  • 操作系统:Windows 10 Home
  • Ruby版本:3.1.0(通过官方安装包rubyinstaller-devkit-3.1.3-1-x64.exe安装)
  • 已安装MySQL和rails gem

解决方案

  • 禁用Bootsnap缓存:修改项目根目录下的config/boot.rb,注释掉require 'bootsnap/setup'这一行,保存后重新执行rails server。
  • 清理缓存目录:删除项目根目录tmp/cache/bootsnap文件夹,执行rails tmp:cache:clear命令后重启服务器。
  • 更换项目路径:将项目迁移到纯英文路径(如D:\sites\ruby\lr5),避免非ASCII字符导致的路径识别问题。
  • 更新依赖版本:更新Ruby到3.2.x等稳定兼容版本,同时执行gem update bootsnap更新到最新版。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 21:30:47