I want to use the ImageSpec gem so have the following in a file:
require 'imagespec'
but get the following load error at runtime:
`require': cannot load such file -- imagespec (LoadError)
gem list ruby-imagespec shows:
*** LOCAL GEMS ***
ruby-imagespec (0.3.1)
but gem which ruby-imagespec gives:
ERROR: Can't find ruby library file or shared library ruby-imagespec
How do I require the file?
You need to use require 'image_spec'. See the init.rb file for the gem.
Related
I referred to this link to build a Ruby gem. After doing:
gem build hola.gemspec
when I try to require the gem in irb, it throws this error:
LoadError (cannot load such file -- word_counter_gem)
Can you tell me what the issue is?
I installed the libxml-ruby gem, with the --platform=x86_64 flag, and whenever I try to require 'xml' I get an error.
Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require':
126: The specified module could not be found.
- I:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/libxml-ruby-3.0.0/lib/libxml_ruby.so (LoadError)
I checked, and libxml_ruby.so is in that directory. Any ideas on how to fix this?
I am using Ruby version 2.4.1 on Windows 10.
Ok so inside my Gemfile I have this gemspec
gem 'output', '0.1.0', git: 'ssh://git#git.company.com/pe/gem-output.git', tag: 'master'
When I run bundler install from RubyMine is says it was successful.
but in my ruby code when I try to call Output.write(message) it says:
`message': uninitialized constant Pmt::Output (NameError)`
So then if I do a require 'output' at the top of my file I get this error message:
`require': cannot load such file -- output (LoadError)`
Any advice would be much appreciated.
I am using Ubuntu 12.04.4
Here is my gem list:
gem list
*** LOCAL GEMS ***
dicom (0.9.5)
gsl (1.15.3)
narray (0.6.0.8)
rb-gsl (1.16.0)
rmagick (2.13.2)
I have installed the gsl library in my home directory.
I then open irb and "require gsl" where I get the following error message:
require 'gsl'
LoadError: no such file to load -- gsl
from (irb):1:in `require'
from (irb):1
from :0
Any ideas on why this error appears.
Thanks for your time
Check the value of $LOAD_PATH in irb. This will tell you where require is looking for files. I'm guessing that your ruby/irb/gem environments have conflicting versions.
I struggle to have gems correctly loading in a Snow Leopard environment. I installed ruby and rubygems in '/usr/local' (from http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/ instructions), I installed some gems with 'gem install gem-name'.
I correctly see the gem list:
$ gem list
*** LOCAL GEMS ***
chrisjpowers-iterm_window (0.3.2)
gemcutter (0.3.0)
I can see the gems correctly installed:
$ ls /usr/local/lib/ruby/gems/1.8/gems/
chrisjpowers-iterm_window-0.3.2
gemcutter-0.3.0
And the gem path correctly defined:
$ gem env path
/usr/local/lib/ruby/gems/1.8
And I defined various paths in my bash profile:
$ cat ~/.bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export GEM_HOME="/usr/local/lib/ruby/gems/1.8"
export GEM_PATH="/usr/local/lib/ruby/gems/1.8"
export RUBY_LIB="/usr/local/lib/ruby:/usr/local/lib/ruby/site_ruby"
However when I run the following script
#!/usr/local/bin/ruby
require 'rubygems'
require 'chrisjpowers-iterm_window'
I get the following error
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- chrisjpowers-iterm_window (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/bin/sp:4
I have no idea how to fix it, any help would be greatly appreciated :)
You're requiring the wrong lib name. The gem is named chrisjpowers-iterm_window because of GitHub namespacing, but the library is named iterm_window:
require 'rubygems'
require 'iterm_window'
The lib path differs from the gem path. The gem path is where the gems are installed, but the lib path contains the lib directory of every installed gem after rubygems is loaded. You should see an iterm_window.rb inside the lib directory of that gem.