Ubuntu已预装Jekyll时,为何无法通过Bundler与~/gems安装最新版Jekyll?
Jekyll安装中Bundler找不到colorator-1.1.0的问题
问题背景
按照Jekyll官方分步教程安装Jekyll并创建新项目,执行bundle或bundle install步骤时,安装若干gem后失败,报错找不到colorator-1.1.0.gem。实际该gem在rubygems源中存在,且已安装在/usr/share/rubygems-integration/all/gems/colorator-1.1.0路径下。
完整报错信息
Bundler::GemNotFound: Could not find colorator-1.1.0.gem for installation /home/alan/gems/gems/bundler-4.0.1/lib/bundler/source/rubygems.rb:172:in `install' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/installer/gem_installer.rb:54:in `install' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/installer/gem_installer.rb:17:in `install_from_spec' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/installer/parallel_installer.rb:133:in `do_install' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/installer/parallel_installer.rb:124:in `block in worker_pool' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/worker.rb:62:in `apply_func' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/worker.rb:57:in `block in process_queue' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/worker.rb:54:in `loop' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/worker.rb:54:in `process_queue' /home/alan/gems/gems/bundler-4.0.1/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads' An error occurred while installing colorator (1.1.0), and Bundler cannot continue. In Gemfile: jekyll was resolved to 4.4.1, which depends on colorator
排查过程中的现象
- 删除
~/gems目录并跳过gem install jekyll bundler命令后,bundle install可成功执行,无错误安装包括colorator-1.1.0在内的所有gem。 - 卸载Ubuntu系统预装的Jekyll(执行
apt-get remove jekyll && apt-get autoremove)后,按照官方教程步骤可正常运行。 bundle install启动时会出现以下警告:Fetching gem metadata from https://rubygems.org/........... Local specification for listen-3.9.0 has different dependencies than the remote gem, ignoring it Local specification for jekyll-4.3.2 has different dependencies than the remote gem, ignoring it
疑问
原本认为Bundler的设计目的就是规避旧系统包带来的冲突,现在有以下疑问:
- 这个问题的具体原因是什么?
- 有没有其他规避方法,是否必须依赖无冲突的系统包?
- 相关文档中是否有针对此类情况的说明?
- 是否有比Jekyll文档中“避免以root用户安装RubyGems包”更直接的操作指引?
软件版本信息
- Ubuntu 24.04
- Ubuntu预装Jekyll:4.3.2+dfsg-1
- Ubuntu预装ruby-bundler:2.4.20-1
- gem安装的Jekyll:4.4.1
- gem安装的Bundler:4.0.1
内容的提问来源于stack exchange,提问作者sourcejedi
相关产品推荐
相关产品推荐

