bundle

bundle exec与直接运行的差异

January 6, 2026

摘要 以jekyll serve​为例,它默认使用的系统的相关包和环境。而bundle exec Jekyll serve​是使用Gemfile.lock里申明的包的版本来运行。 当系统的包的版本与Gemfile.lock​中不一致时,特别是系统的版本比Gemfile.lock里的版本高时,会报错。 所以,推荐使用bundle exec Jekyll serve 案例: 通过bundle install生成的Gemfile.lock bigdecimal (3.3.1),运行jekyll serve提示现在bigdecimal 版本为4.0.1,能怎么提升bundle install 生成bigdecimal的版本吗? AI答案: 通过 bundle update​ 后,Gemfile.lock 中的 bigdecimal​ 仍然是 3.3.1,因为它是间接依赖(通过