Gemfile.lock含middleman-cli,但bundle install未安装该依赖致报错
bundle exec to Access Your Bundled Gems The problem here boils down to how Bundler isolates gem environments when you use the --path flag. When you run bundle install --no-cache --path ./vendor/bundle, all required gems (including middleman-cli) get installed into the local ./vendor/bundle directory—not your system-wide or user-specific gem repository. That’s why commands like ruby -S gem list --local don’t show any middleman-related gems: they’re looking in the wrong place!
Bundler creates a self-contained gem environment for your project, so to use any of those gems, you need to run commands through Bundler itself with the bundle exec prefix. Here’s how to fix this:
Run widdershins via Bundler
Instead of callingwiddershinsdirectly, use this command to ensure it uses your project’s isolated gem set:bundle exec widdershins [path-to-your-openapi-spec] [output-file]This will let widdershins access the middleman-cli gem installed in
./vendor/bundle.Verify installed gems correctly
To see all gems Bundler installed for your project (including middleman), run:bundle exec gem list --localUnlike your previous commands, this will show you the full list of gems in your project’s isolated environment.
Update your Jenkinsfile
Make sure any subsequent commands that rely on the project’s gems are also prefixed withbundle exec. For example, if you’re building the Slate docs later, your command should look like:sh 'bundle exec middleman build'
The core takeaway: when you use --path with bundle install, you’re opting into an isolated gem environment—so all tooling that depends on those gems must be run through bundle exec to access them.
内容的提问来源于stack exchange,提问作者Ben

