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

Hanami 2.0.1+Ruby3.0.2项目创建及启动报错求助

Hanami 2.0.1 + Ruby 3.0.2 项目问题解决

问题1:项目创建时bundle install失败

报错信息:

Created bookshelf/
-> Within bookshelf/
Created .env
Created README.md
Created Gemfile
Created Rakefile
Created config.ru
Created config/app.rb
Created config/settings.rb
Created config/routes.rb
Created config/puma.rb
Created lib/tasks/.keep
Created lib/bookshelf/types.rb
Created app/actions/.keep
Created app/action.rb
Running Bundler install...
`bundle install' failed

"install: unknown option -- jobs=2
Try 'install --help' for more information."

解决步骤:

  • 执行项目创建命令时跳过自动bundle安装:hanami new bookshelf --skip-bundle
  • 进入项目目录后手动执行bundle install完成依赖安装。

问题2:启动hanami server时找不到guard gem

报错信息:

C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.3.26/lib/bundler/rubygems_integration.rb:308:in `block in replace_bin_path': can't find executable guard for gem guard. guard is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.3.26/lib/bundler/rubygems_integration.rb:336:in `block in replace_bin_path'
        from C:/Ruby30-x64/bin/guard:23:in `<main>'

解决步骤(二选一):

  • 安装开发环境依赖:bundle install --with development,guard属于Hanami开发依赖组,此命令会自动安装所需的guard及相关依赖。
  • 启动server时跳过文件热重载:bundle exec hanami server --no-live-reload,避免触发guard调用。

问题3:添加guard后提示缺少Guardfile

报错信息:

No Guardfile exists at Guardfile. (Guard::Guardfile::Evaluator::NoCustomGuardfile)

解决说明:
手动添加guard到Gemfile会导致缺少Hanami适配的Guardfile配置,无需此操作。直接使用问题2中的任意一种解决方法即可,无需额外配置Guardfile。若确实需要手动生成Guardfile,可执行:bundle exec guard init hanami,生成适配Hanami的配置文件。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 11:10:41