ruby/rubygems · error · Bundler::GemfileNotFound

10

10

Error message

Could not locate Gemfile

What it means

Error "Could not locate Gemfile" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/shared_helpers.rb:15

# frozen_string_literal: true

require_relative "version"
require_relative "rubygems_integration"
require_relative "current_ruby"

module Bundler
  autoload :WINDOWS, File.expand_path("constants", __dir__)
  autoload :FREEBSD, File.expand_path("constants", __dir__)
  autoload :NULL, File.expand_path("constants", __dir__)

  module SharedHelpers
    def root
      gemfile = find_gemfile
      raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
      Pathname.new(gemfile).expand_path.parent
    end

    def default_gemfile
      gemfile = find_gemfile
      raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
      Pathname.new(gemfile).expand_path
    end

    def default_lockfile
      given = ENV["BUNDLE_LOCKFILE"]
      return Pathname.new(given) if given && !given.empty?

      gemfile = default_gemfile

      case gemfile.basename.to_s
      when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
      else Pathname.new("#{gemfile}.lock")

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/shared_helpers.rb:15 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/b1deb8d7dda53903. Report an issue: GitHub.