Rails uninitialized constant Bundler (NameError)

前端 未结 3 761
半阙折子戏
半阙折子戏 2020-12-14 11:34

I\'m getting the following error when running any rails commands like rails s or rails c, it\'s also preventing my heroku app from starting (same e

3条回答
  •  天涯浪人
    2020-12-14 12:27

    I have problems like you, subscribe my case.

    config/applicataion.rb:

    require_relative 'boot'
    
    require 'rails/all'
    
    # Require the gems listed in Gemfile, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(*Rails.groups)
    
    module AppName
      class Application < Rails::Application
        config.load_defaults 5.2
      end
    end
    

    where require_relative 'boot' is very important, such as config/boot.rb:

    ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
    
    require 'bundler/setup' # Set up gems listed in the Gemfile.
    

    has including bundler library into application.

提交回复
热议问题