vikash kumar vikash kumar - 2 months ago 4x
Ruby Question

getting no such file to load -- xyz (LoadError)

I have cloned a ruby project from git hub,after cloning I performed bundle install. Now I am trying to run this project but getting require: no such file to load-- xyz (LoadError).

I am running my prj.rb file from bin and it contains

require 'xyz'

This xyz.rb is in the lib folder of my project.


One solution is to add lib directory to autoload by adding to config/application.rb

config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]


require "#{Rails.root}/lib/xyz"