Error running gem env - ruby

When I run gem env, I get the following error:
Error loading RubyGems plugin "/home/chenge/.rvm/gems/ruby-1.9.2-p320#global/gems/rubygems-bundler-0.9.2/lib/rubygems_plugin.rb": undefined method `first' for #<String:0x8ec8670> (NoMethodError)
Could anybody help me to understand what this means? Thanks.
gem clean
Cleaning up installed gems...
Attempting to uninstall rvm-1.11.3.3
Unable to uninstall rvm-1.11.3.3:
Gem::InstallError: gem "rvm" is not installed
Attempting to uninstall rubygems-bundler-0.9.2
Unable to uninstall rubygems-bundler-0.9.2:
Gem::InstallError: gem "rubygems-bundler" is not installed
Attempting to uninstall bundler-1.1.3
Unable to uninstall bundler-1.1.3:
Gem::InstallError: gem "bundler" is not installed
Clean Up Complete

Your rubygems-bundler is out-date(0.9.2), install the latest version(1.1.0) will fix that.
$ gem clean
$ gem install rubygems-bundler
I tried on my EC2 instance, it works.

the problem may be caused by:
incorrectly installed Ruby
incorrectly installed RubyGem
incorrectly installed RVM
I suggest you remove the rubygem entirely. ( rm /home/chenge/.rvm/gems -rf ) and then download the latest rubygem then re-install it.

Related

Gitlab installation - Ruby rail error

I'm using Ubuntu 16.10 and was updating my Gitlab from 6.8 to 7 and everything went wrong. Now I have removed it and is trying to install a new version but ran into a problem with Ruby.
When I try install it
$ sudo apt install gitlab
I get an error after some time:
Could not find gem 'rails (>= 4.2.7.1, ~> 4.2.7)' in any of the gem sources
listed in your Gemfile.
I have tried to run
$ sudo gem install rails
but this gives me another error:
ERROR: Error installing rails:
activesupport requires Ruby version >= 2.2.2.
I don't know what to do now...
I have started all over... Removed gitlab* and postgresql. Rebooted and installed gitlab again. Now I got another error:
Could not find gem 'pg (~> 0.18.2)' in any of the gem sources listed in your Gemfile.
Tried to install pg manually:
$ sudo gem install pg
Successfully installed pg-0.20.0
But still sudo apt upgrade gives the same error: "Could not find gem 'pg'
You may be missing a hidden dependency. Try the following:
sudo apt-get install libpq-dev
I gave up! I reinstalled the Linux server with the Linux LTS version and used the Omnibus package installation..
Problem solved!

Could not find gem 'logstash-devutils (>= 0) ruby' in any of the gem sources

I'm just trying to learn to write the example-output-plugin,follow this page:
http://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html#_clone_and_test_4
when I type the "bundle install" in the folder ~/logstash-output-example,I get the the error:
Could not find gem 'logstash-devutils (>= 0) ruby' in any of the gem sources
listed in your Gemfile or installed on this machine.
it seems the gem 'logstash-devutils (>= 0) ruby' missed,but when I type the
"sudo gem install logstash-devutils", I get the error
ERROR: Could not find a valid gem 'logstash-devutils' (>= 0)
Here is why:
Found logstash-devutils (0.0.12), but was for platform java
Anyone else can help me?
environment:MAC OSX 10.9.5
I just ran into the same problem. Solved it by just downloading the gem via the download link on its rubygems.org page and installing it with:
sudo gem install logstash-devutils-0.0.13-java.gem
That worked for me.
Update:
Well, that will install the gem but it will not solve the real problem. I needed to switch to jruby for the tutorial to work. This can be done via the RVM:
sudo rvm install jruby
I tried installing the gem manually and got a different error:
There was a RuntimeError while loading logstash-devutils.gemspec:
Only JRuby is supported from
/Users/bnewton/.rvm/gems/ruby-2.2.1/bundler/gems/logstash-devutils-15c59bfaab59/logstash-devutils.gemspec:2:in `'
This leads me to believe the logstash-devutils requires jruby rather than the usual ruby. I use rvm, so it was a matter of installing and using jruby instead of regular ruby. So if you are using rvm, run:
rvm install jruby-1.7.19
rvm use jruby-1.7.19
gem install bundler
bundle install
This fixed it for me, and I was able to run bundle install without error.

Rails rdoc Gem error/corruption issue

I'm getting the below error message when creating a new rails app.
Bundler::GemspecError: Could not read gem at /Users/xyz/.rvm/gems/ruby-2.1.1/cache/rdoc-4.2.0.gem. It >may be corrupted.
An error occurred while installing rdoc (4.2.0), and Bundler cannot continue.
Make sure that gem install rdoc -v '4.2.0' succeeds before bundling.
I am on Ruby 2.1.1 and Rails 4.1.6. I have tried:
gem install rdoc -v '4.2.0'; no change.
gem install rdoc; no change.
gem install rails; no change.
gem install rails --no-ri --no-rdoc; no change.
gem uninstall rails; elect to uninstall all versions.
gem install rails; hangs for a long time on 'installing ri documentation'.
gem uninstall rails; removes the hald installed 4.1.8 vers installed in last cmd.
gem install rails --no-ri --no-rdoc; installs without issue.
rails new new_app_name; exactly the same rdoc error issue even though I specified an install without rdoc!!
Bundler::GemspecError: Could not read gem at /Users/jamesbkemp/.rvm/gems/ruby-2.1.1/cache/rdoc->4.2.0.gem. It may be corrupted.
An error occurred while installing rdoc (4.2.0), and Bundler cannot continue.
Make sure that gem install rdoc -v '4.2.0' succeeds before bundling.
I seem to be stuck on this error, bundle install or update isn't doing anything to help either. Can anyone help?
Just removed the two sited instances of 'gem rdoc' from gemfile.lock, still the same issue.
FYI - Seemed to be an issues with Bundler. Removed bundler and reinstalled and all seemingly ok.
I encountered the problem today and resolved the issue by deleting "rdoc->4.2.0.gem" from the cache folder and after that all you have to do is open command prompt and type gem install rdoc -v '4.2.0' and press enter , it will show a warning that
do you want to overwrite the executable file in bin folder (Y/N).
Type Y and press enter and you are ready for the ride.

bson_ext 1.7.0 fails to build on Linux when using bundle:install Capistrano task

Here is the error message:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
Gem files will remain installed in /var/www/app_dir/shared/bundle/ruby/1.8/gems/bson_ext-1.7.0 for inspection.
Results logged to /var/www/app_dir/shared/bundle/ruby/1.8/gems/bson_ext-1.7.0/ext/cbson/gem_make.out
An error occured while installing bson_ext (1.7.0), and Bundler cannot continue.
Make sure that `gem install bson_ext -v '1.7.0'` succeeds before bundling.
I tried running gem install bson_ext -v '1.7.0' and this succeeded with no errors. I've tried installing ruby-dev and ruby1.8-dev apt packages and this did not help.
bundle install is able to successfully build bson_ext on my Mac OS X development system but is failing in the Linux production environment even when I run it directly outside of the context of the capistrano bundle:install task.
I have also tried running gem update --system and gem update bundler and this didn't help.
I suspect the issue lies in how bundle install is called on the target system. Still, I tried updating Capistrano to version 2.13.5 and this did not help.
So, it appears that bundler 1.2.1 is is unable to build the following gems on my system:
bson_ext 1.7.0
curb 0.8.3
nokogiri 1.5.5
json 1.7.5
therubyracer 0.8.2.
I was able to build these using gem install <GEMNAME> -v '<VERSION>' --install-dir /var/www/<APP_DIR>/shared/bundle/ruby/1.8/. After this, running bundle exec capistrano deploy succeeded.
bundle does not appear to be able to build gems with native extensions on my system. Not sure why, but maybe this procedure will help those with a similar issue.

RubyGems issue on OS X Lion

I created a new RoR application, but whenever I run bundle install (which installs RSpec along other gems) I get the following error:
Gem::Package::FormatError: no metadata found in /Users/petarpetrovic/.rvm/gems/ruby-1.9.3-p194/cache/selenium-webdriver-2.22.0.gem
An error occured while installing selenium-webdriver (2.22.0), and Bundler cannot continue.
Make sure that gem install selenium-webdriver -v '2.22.0' succeeds before bundling.
When I run gem install selenium-webdriver -v '2.22.0', I get the following error message:
ERROR: Error installing selenium-webdriver:
invalid gem format for /Users/petarpetrovic/.rvm/gems/ruby-1.9.3-p194/cache/selenium-webdriver-2.22.0.gem
I tried manually removing the gem from cache folder and then rerun bundle install but I still get the same error messages.
Any ideas how to fix this?
Update gems
gem update --system
gem update
Check Gemfile in your rails application. Should content: gem "selenium-webdriver", "~> 2.22.0"
Run bundle install again.
I don't quite understand the above solution although it might work for someone. I ran into the same error but with different gem. I got problem with nokogiri and got this error message:
Gem::Package::FormatError: no metadata found in /home/myname/.rvm/gems/ruby-1.9.3-p194/cache/nokogiri-1.5.5.gem
I went to /home/myname/.rvm/gems/ruby-1.9.3-p194/cache/ and removed the file nokogiri-1.5.5.gem and I was able to run bundle again. I think there is something messed up with the .gem file.
Remove the cached copy of the gem and then try installing it again
rm -rf /Users/petarpetrovic/.rvm/gems/ruby-1.9.3-p194/cache/selenium-webdriver-2.22.0.gem
gem install selenium-webdriver -v '2.22.0'

Resources