I'm getting this error when running my script:
`require': cannot load such file -- rdoc/usage (LoadError)
from
/Users/S/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rdoc/usage (LoadError)
from /Users/S/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from pdf.rb:34:in `<main>'
I have rdoc in my Gemfile
gem 'rdoc', '~> 4.2.2'
and I have also tried without specifying version. In my script I've required gems and rdoc/usage:
require 'rubygems'
require 'rdoc/usage'
I have run gem install rdoc
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed rdoc-4.2.2
and as I'm running ruby 2.2.2 should not need to install ruby roc/ri data. (I tried at a loss and as expected no effect).
Any help would be greatly appreciated, thanks.
The old rdoc/usage module was removed from rdoc quite some time ago, namely in Ruby 1.9.1 (when rdoc was still part of the Ruby core language). See https://bugs.ruby-lang.org/issues/2713 for a discussion or the SVN commit.
Thus, with recent Rubies, there is no way to use this module anymore. You should update your code to use alternatives to generate documentation.
Related
I've had some trouble with gems from a local source before, so set up a simple test project. I haven't had simple-rss installed before. This is my Gemfile:
source 'https://rubygems.org'
gem 'simple-rss', :path => '~/code/simple-rss'
I then run bundle install, it tells me:
Using simple-rss 1.2.3 from source at `~/code/simple-rss`
Using bundler 1.12.4
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
So then I make test.rb in the same folder as the Gemfile. The test.rb file only has the require right now:
require 'simple-rss'
I run ruby test.rb, and get this error:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- simple-rss (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from test.rb:1:in `<main>'
So that's the first evidence of a problem. I then do:
sudo gem install simple-rss
That successfully installs it. I do ruby test.rb again, and get no issues. So it's able to run the gem from the original source once it's been installed with gem install, but not from the local source after running with Bundler.
If you want to use the gems dictated in your Gemfile, I suggest prefixing your commands with bundle exec, eg. bundle exec ruby test.rb. Otherwise your Ruby will not know about them.
I am trying to run GitLab on my server.
But the service won't start up.
It puts out:
==> /var/log/gitlab/sidekiq/current /var/log/gitlab/unicorn/current <==
2016-01-26_16:35:06.79546 failed to start a new unicorn master
2016-01-26_16:35:06.80558 starting new unicorn master
2016-01-26_16:35:07.10485 Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
2016-01-26_16:35:07.11661 bundler: command not found: unicorn
2016-01-26_16:35:07.12170 Install missing gem executables with `bundle install`
My System:
Ubuntu 14.04
Plesk 12.5
Ruby 1.9.3
Gem 1.8.23
Bundler 1.11.2
I tried to run
gem install unicorn
But than I get the Error:
Building native extensions. This could take a while...
ERROR: Error installing unicorn:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/kgio-2.10.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/kgio-2.10.0/ext/kgio/gem_make.out
I have no experience with ruby. So anyone has a suggestion what I'm doing wrong ?
Thanks in advance
Dominic
Are you limited to Ruby 1.9.3? Currently the most stable version of Ruby is 2.3.0. Updating Ruby will probably fix this issue.
https://www.ruby-lang.org/en/downloads/
Alternatively, before updating Ruby, check out this thread. Here is a similar error someone had with Ruby 1.9.1. `require': no such file to load -- mkmf (LoadError)
It looks like people on that thread had success using build-essential:
sudo apt-get install build-essential
I know I have ruby and gem installed because I've installed a bunch of gems previously. Additionally when I do the following
~$ ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302 [i486-linux]
~$ gem --version
1.3.7
They, as you can see, return the version--yet when I try to do this--
~$ sass --watch happy.scss:happy.css
bash: sass: command not found
I'm a relative noob to everything, but far more to ruby and gems. For the sake of revealing more or less my level of understanding things generally I've learned enough of Debian to get a an environment where I could get Clojure running and get a web app working (taken me almost a year of spare time to do that--I knew virtually nothing of programming previoiusly). I'm trying to get sass working to ease my mental load in the webpage design side of things and I'm just hitting a brick wall on this.
Would this be a PATH issue? If so what needs to be on the path so that one gem works --
BTW here's what happens when I install sass--
# gem install sass
Successfully installed sass-3.2.5
1 gem installed
Installing ri documentation for sass-3.2.5...
Installing RDoc documentation for sass-3.2.5...
Any help anyone can give will be much appreciated. I've been at this one all day and can't figure it out for the life of me.
justin ⮀ ~ ⮀ gem install sass
Fetching: sass-3.2.5.gem (100%)
Successfully installed sass-3.2.5
1 gem installed
justin ⮀ ~ ⮀ sass -v
Sass 3.2.5 (Media Mark)
seems ok to me. I would check your path.
The proper PATH would depend on where your gems get installed. I use RVM so it will be different. You could try to throw an exception in your ruby code with rubygems loaded this should give you a starting point.
> rails c
Loading development environment (Rails 3.2.11)
1.9.3p362 :001 > throw test
ArgumentError: wrong number of arguments (0 for 2..3)
from (irb):1:in `test'
from (irb):1
from /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:5:in `require'
from script/rails:5:in `<main>'
so from that i see /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/gems/railties-3.2.11/lib/rails/commands/console.rb
so my bin path is at /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/bin
and if i
> ls /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/bin
b2json capify fog html2haml nokogiri rails ri sass-convert therubyracer tilt
bundle coderay geocode httpclient oauth rake2thor ruby_noexec_wrapper scss thin tt
cap erubis haml j2bson rackup rdoc sass sprockets thor
boom sass
so in my case I would want to add /Users/justin/.rvm/gems/ruby-1.9.3-p362#rails3.2/bin
but i use RVM so it does that for me.
I'm on Ubuntu, and I've done
install gem mongo
which reported
Successfully installed bson-1.0
Successfully installed mongo-1.0
2 gems installed
I've started mongod
Now I cd to the mongo gem directory and try
> ruby examples/simple.rb
and I get the error
./examples/../lib/mongo.rb:31:in `require': no such file to load -- bson (LoadError)
from ./examples/../lib/mongo.rb:31
from examples/simple.rb:3:in `require'
from examples/simple.rb:3
which I can't make sense of, since the bson gem is installed
> gem list
*** LOCAL GEMS ***
bson (1.0)
bson_ext (1.0)
mongo (1.0)
rack (1.1.0)
sinatra (1.0)
Any suggestions what's up here?
The example script doesn't require rubygems, which means that bson isn't going to be in your load path. If you add
require 'rubygems'
to the start of the script, I believe it will work.
Can anyone help with an odd Ruby Gem problem I'm having - note I've installed many gems in the past and never seen this.
I've downloaded the net-ssh and net-sftp gems using the following commands:
sudo gem install net-ssh
sudo gem install net-sftp
both installed successfully. However when I reference the files within my code I get the following error:
./workers/ffmpeg_worker.rb:6:in `require': no such file to load -- net/ssh (LoadError)
from ./workers/ffmpeg_worker.rb:6
from ./workers/tests/test_ffmpeg_worker.rb:3:in `require'
from ./workers/tests/test_ffmpeg_worker.rb:3
from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
Note when I do:
gem list --local
The gems are listed as such:
net-scp (1.0.2)
net-sftp (2.0.2, 1.1.0)
net-ssh (2.0.15, 1.1.2)
net-ssh-gateway (1.0.1)
Any clues?
When I see this sort of thing, it usually comes down to having more than one Ruby installed on the machine (which means more than one gem location, etc.), and different apps or environments getting confused about which one to load.
Check for that first. If that isn't the answer, do a gem which net/ssh to see where RubyGems thinks the gem is installed -- make sure it isn't the local user's .gems directory or something.
If neither one solves the mystery, stick some debugging code into your worker script and have it output its load path ($:) so you can see where it's looking.