Ruby 'require' error: cannot load such file
I just tried and it works with require "./tokenizer"
. Hope this helps.
Ruby error : Cannot load such file
require_relative "image_utils"
Based on your Ruby version, using require
assumes that image_utils.rb
is in the $LOAD_PATH (this requires additional setup) as Ruby 1.9 has removed the current directory from the load path. Use require_relative
instead.
Ruby will first try to resolve the file by its absolute path. Then, if it isn't found then it will check on the $LOAD_PATH as mentioned above, if not then it will throw a LoadError
http://ruby-doc.org/core-2.0.0/Kernel.html#method-i-require
Rails `require': cannot load such file -- matrix
Matrix was removed from Ruby's standard library in version 3.1. More info: https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released/
With Ruby 3.1, matrix needs to be explicitly added to the Gemfile. You can add it manually or run something like:
$ bundle add matrix
After it's added to the Gemfile, bundle your application:
$ bundle install
Then your application should continue to behave like it did in previous Ruby versions.
Ruby `require': cannot load such file (LoadError)
According to API Dock, require_relative
is what you need.
Ruby tries to load the library named string relative to the requiring
file’s path. If the file’s path cannot be determined a LoadError is
raised. If a file is loaded true is returned and false otherwise.
So all you have to do is
require_relative "file-a"
require_relative "file-b"
require_relative "file-c"
How to fix Ruby error: `require': cannot load such file -Programing Ruby 1.9 & 2.0 4th edition
gserver
used to be part of Ruby's standards library for some time. However, it was removed from the standards library with Ruby 2.2.0 since it was basically unmaintained and had no tests.
This (un-)maintenance status has not really changed since. If you still need the functionality of the library, you can install and use the gserver
gem which contains the code state as it was removed form the standards library. However, I would strongly recommend to use something else instead...
Related Topics
Adding a Directory to $Load_Path (Ruby)
How to Run a Rake Task from Capistrano
Understanding Ruby'S Load Paths
Aws S3: the Bucket You Are Attempting to Access Must Be Addressed Using the Specified Endpoint
How to Uninstall Ruby on Ubuntu
Paginating an Array in Ruby With Will_Paginate
How to Remove Emoji from String
Cannot Load Such File - Script/Rails: Getting This Error While Remote Debugging Through Rubymine
How to Convert a Ruby Hash Object to Json
Find Out If Current Time Is Between Two Times
How to Get the Current Absolute Url in Ruby on Rails
How to Sort an Array in Descending Order in Ruby