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/**/"]
Other
require "#{Rails.root}/lib/xyz"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.