Ruby gems installation error - ruby

When I am trying to install a gem or run anything with gem command, I see this warning,
Error loading RubyGems plugin "/Users/ender/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.9.0/lib/rubygems_plugin.rb": undefined method `first' for #<String:0x007ffedc0964f0> (NoMethodError)
I searched it but I could not find anything out.
What is the problem and how can I fix it?
Note: I cannot install any gems.
Thanks.

Try removing the /Users/ender/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.9.0 directory. There seems to be a problem with this gem.

Related

Issues installing/updating Bundler

I have tried this a number of different ways. First I tried with RVM and it was just error after error and missing dependencies. Then I tried Rbenv and it was very much the same.
Now, I have a combo of chruby and ruby-install to handle my versions of Ruby, but I can't update Bundler.
It says that I am currently on 1.17.2, but I need 1.17.3.
How do I upgrade this? I have searched everywhere, but all the solutions seems to be for RVM.
When I try to update Bundler this is the error that I get:
$ gem update bundler
ERROR: Loading command: update (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I don't know what is causing this or how to get around it. Any help would be appreciated as I can't seem to find anything describing what is happening.
So, it turns out that I had multiple versions of Bundler installed on my machine and, somehow, two of them were simultaneously set to the default version.
Manually finding the installed versions, deleting them and then reinstalling the desired version seemed to fix the issue.
The key is using a Ruby manager (RVM, rbenv, etc.) and ensuring that any installation of a Ruby version and/or gems are done at either a system level or inside of a project as required.

toy/doc undefined method 'available?'

I'm attempting to build local Ruby documentation as suggested here:
https://github.com/toy/doc
However when I use the default Rakefile I get the following:
[Documentation]$ rake build
configuring and updating: 100.0%
rake aborted!
undefined method `available?' for Gem:Module
/Users/snowcrash/.rvm/gems/ruby-2.0.0-p195/gems/sdoc-0.2.20/lib/sdoc/json_backend.rb:9:in `<top (required)>'
Any suggestions?
I don't know much about ruby (and even less about the gem ecosystem built up around it), but I believe a possible workaround for this issue is to find what gems the project requires and manually install them. In the case of this particular project, it looks like you need the gem "fspath".
At the project root, type
gem install fspath
and try re-running rake.
I honestly don't know the actual root cause of the issue, other than that presumably, your version of the 'gem' program is probably > v2, while some other program (rake?) expects it to be older and still support the "available?" method.
If installing "fspath" doesn't fix the issue, you could try downgrading your version of gem by doing
gem install -v [some version of gem older than v2]
Check gem install --help for more info on this.
This is just for future visitor who has the same issue.
As ekremkaraca said, you can just solve this by downgrading rubygems.
rvm install --force rubygems 1.4.2

Can I control the version of rubygems that IntelliJ uses?

I'm trying to start a rails application in IntelliJ with the Ruby plugin.
I've imported the application and set up the run configuration as best I can. When I try to run it I get the error:
NoMethodError: undefined method `version_requirements' for #<Gem::Dependency:0x7de21f45>
When looking for an answer I found this page saying that I should do this:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Since it's IntelliJ's ruby plugin that is managing the gems, I assume that I have to change the version of rubygems-update that the plugin is using.
Is this the right approach to take? And if so, can anyone tell me how to go about it?
I tried listing the gems but that gem is not shows so I must not be listing the gems in the right place, but I don't know where to look.
Many thanks :)
IntelliJ IDEA cannot handle it, you will need to install the appropriate rubygems version from the command line.
Note that your current rubygems-update version may be different, verify it with gem list and use the reported version when uninstalling.

Rake failing to start

I'm having trouble understanding the following error with Ruby's Rake.
C:\>gem install rake
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7...
Installing RDoc documentation for rake-0.8.7...
C:\>rake
C:/Ruby192/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find executable r
ake for rake-0.8.7 (Gem::Exception)
from C:/Ruby192/bin/rake:19:in `<main>'
Running Ruby 1.9.2 for Windows.
Edit: Installing from source yields:
C:\Documents and Settings\XPherior\Desktop\rake-0.8.7\rake-0.8.7>ruby install.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
ftools (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from install.rb:3:in `<main>'
The second error, where you have installed into C:\Documenets And Settings\ is occurring because you cannot install ruby into a folder with a space in the path. It should be installed into c:\Ruby\ c:\Ruby#.#.#\ if you want the version # in the path, or something along those lines.
for the first error: there is a bug in the rubyinstaller.org version of ruby 1.9.2, which is causing this by running "gem install rake".
you can read about the error you're getting, here: http://redmine.ruby-lang.org/issues/show/3677
there are a couple of ways to fix this error:
re-install ruby v1.9.2 and don't run "gem install rake". rake v0.8.7 is built into the ruby v1.9.2 installation, so you don't need to re-install it.
if you do want to manually install it, you can delete the ruby.gempspec file from your ruby installation. this file is located at (rubyinstalldir)\lib\ruby\gems\1.9.1\specifications
either of these options will fix the problem for you.
i'm not sure which is "better" off-hand... it may be necessary to delete the gemspec file and reinstall rake, to support updates and new versions in the future. i'm not sure, though. we'll find out once rake is updated and we need to install a new version. or, perhaps, the issue will be fixed in the ruby installation by then, and we'll just need to update our ruby install.
I've run into your both errors.
For the first one. Try the solution post at here http://betterlogic.com/roger/2010/11/ruby-1-9-2-rake-woe/.
And for the second error, it's causes by a library update by the ruby 1.9. From the Programming Ruby 1.9, "ftools have been removed (and replaced by fileutils)." I'm not pretty sure but at least that's an explanation.

Sinatra Gem install error

I have been trying to install sinatra in a macbook running leopard system, and I am not able to do it.
I get the following error.
MacBook:rubygems-1.3.7 lakshmanan$ gem install sinatra
WARNING: RubyGems 1.2+ index not found for:
http://rubygems.org/
RubyGems will revert to legacy indexes degrading performance.
Bulk updating Gem source index for: http://rubygems.org/
ERROR: While executing gem ... (NoMethodError)
undefined method `gems' for #<Array:0x101901008>
Please help. I reinstalled gems also. Still I get the same error.
rubygems.org does not seem to be responding right now. Try again later. It's probably nothing on your end.

Resources