Many: `require': cannot load such file -- gem_name (LoadError) after upgrade of ruby/rails
There must be some problem in your local ruby installation.
If you are using rvm gemset then run rvm pristine
on your gemset.
If you are not using gemset then run gem pristine --all
`require': cannot load such file -- gemname non-rails app on server
When you use bundler to install gems outside if Ruby's global gem store, you also need to adapt the $LOAD_PATH
to include this custom location before you are able to require the gem.
The most common way to achieve this is to use bundle exec
. This command comes with bundler and adapts Ruby's $lOAD_PATH
to include the locations of all gems specified in the Gemfile
.
When you start your script as follows, Ruby should be able to find your gems (assuming your bin/run_control.rb
script is executable).
bundle exec bin/run_control.rb start
Making a Ruby Gem - Cannot Load Such File
The spec.files
entry of your gemspec
doesn’t include the mygem.rb
file, so that file won‘t be in the gem when it is built. Only files listed in this entry will be included in the final gem.
The simplest solution would be to just add mygem.rb
to the array:
spec.files = ['lib/command.rb', 'lib/connection.rb', 'lib/mygem.rb']
This is a fairly simple fix, you might want to do something more flexible like using a Dir
glob:
spec.files = Dir['lib/**/*.rb']
In fact the Rubygems guide suggests you do something like this (text is from the end of that section):
If you’ve added more files to your gem, make sure to remember to add them to your gemspec’s files array before publishing a new gem! For this reason (among others), many developers automate this with Hoe, Jeweler, Rake, Bundler, or just a dynamic gemspec.
Also, you really do need to fix your permissions problem, you shouldn’t need sudo
to install gems into your own home directory.
LoadError: cannot load such file -- gemname/base
In your lib/gemname.rb
require 'gemname/base.rb'
Hope in gemname.specification file has
s.files = Dir["README.md","Gemfile","Rakefile", "spec/*", "lib/**/*"]
for example see my gem
https://github.com/rajcybage/google_book
or
http://rubygems.org/gems/google_book
ERROR: `require': cannot load such file -- bindata (LoadError) ( using pcap_tools gem)
I solved this. I talked to the person who created the gem and he push the new version.
https://github.com/bpaquet/pcap_tools
https://github.com/bpaquet/pcap_tools/issues/8
Ruby on Rails - in 'require': cannot load such file -- omniauth/oauth, even though I installed omniauth
These lines:
gem 'omniauth', '0.2.0'
gem 'httparty'
Are meant to go in a file called Gemfile
that is in the root of your project directory. If you are typing them into the command line, that is where you are getting hung up. You should then type bundle install
into the command line to update the dependencies from your app and continue with the tutorial from there.
Related Topics
Exec': String Contains Null Byte (Argumenterror)
Could Not Find Rake with Bundle Exec
Save Image with Mechanize and Nokogiri
Activerecords Select(:Id).Collect VS. Pluck(:Id) Methods: Why Is Pure Ar "Pluck" Slower
How to I Add a Hyperlink to a Cell in Axlsx
Need to Use Add_Index on Migration for Belongs_To/Has_Many Relationship? (Rails 3.2, Active Record)
Kill Process and Sub-Processes in Ruby on Windows
Rvm System-Wide Install Script Url Broken -- What Is Replacement
Programmatically Derive a Regular Expression from a String
What Is the Purpose of the Enumerator Class in Ruby
Why Does a Simple Thin Server Stop Responding at 16500 Requests When Benchmarking
Get, or Calculate the Entropy of an Image with Ruby and Imagemagick
Instance Variable, Class Variable and the Difference Between Them in Ruby
Configuration in Allure to Cucumber in Ruby
Is This the Best Way to Grab Common Elements from a Hash of Arrays