Rails rdoc Gem error/corruption issue - ruby

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.

Related

Error installing nokogiri: invalid gem: package is corrupt

I'm trying to parse a website by using jekyll on my Debian x64 and I get a problem with this following gem nokogiri , in particular I've been required on install the version 1.8.5 , but as it was not working I attempted downloading the last version nokogiri (1.11.0.rc2) Manualy from the web and now I'm stuck with this error.
bundle exec jekyll serve
Could not find nokogiri-1.8.5 in any of the sources
Run `bundle install` to install missing gems.
bundle install
Bundler::GemspecError: Could not read gem at
/var/lib/gems/2.7.0/cache/nokogiri-1.8.5.gem. It may be corrupted.
An error occurred while installing nokogiri (1.8.5), and Bundler
cannot continue.
Make sure that `gem install nokogiri -v '1.8.5' --source
'https://rubygems.org/'` succeeds before bundling.
I think you don't have it's dependancy library libxml2 try running below code.
brew install libxml2
if not worked add nokogiri gem using below command
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]

bundle install fails on nokogiri

I'm installing some chef dependencies following this website:
https://learnchef.opscode.com/starter-use-cases/multi-node-ec2/
I got to the bundle install part, here's what my Gemfile looks like:
source 'https://rubygems.org'
gem 'berkshelf'
gem 'chef'
gem 'knife-ec2'
I get this error when I try to run
bundle install --path vendor:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
...
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
I went to the nokogiri site and I was able to follow the directions and successfully install nokgiri 1.6.0 with homebrew .9.5:
nokogiri --version
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
# Nokogiri (1.6.0)
I get the same message when I then try running the bundle install again. I'm told that the bundle installer doesn't care about installs done outside of it. How to I get around this and install these dependencies?
After a little digging, I figured it out. This is specifically for OSX Mountain Lion.
The rbenv bundler needs to know the same paths specified using these switches given by the nokogiri site:
http://nokogiri.org/tutorials/installing_nokogiri.html
This is done using the bundler config command:
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar /libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
I still ran into troulbe because the config was only picking up the first line of that config setting. I had to edit $HOME/.bundle/config and take out some newlnes before it would take all of the switches. I hope this will save someone else some time.

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'

bcrypt-ruby won't install with bundler but works fine with gem install

I just recently began having trouble with bundler - bcrypt-ruby will not install when doing a bundle install or sudo bundle install and exits with the following error:
Installing bcrypt-ruby (2.1.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4 for inspection.
Results logged to /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (2.1.4), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '2.1.4'` succeeds before bundling.
However, gem install bcrypt-ruby -v '2.1.4' runs just fine (and in fact has already been run on this box). Running /usr/bin/ruby1.8 extconf.rb manually works just fine, and the resulting Makefile also runs with make just fine.
I'm using Ruby 1.8.7 and bundler 1.0.21 on Ubuntu 10.04.1 LTS. Other gems seem to be working fine through bundler. Though this is probably obvious, I've confirmed that the ruby-dev, gcc, etc packages are installed. I've tried using the --deployment option with bundler with no different behavior. The only thing I can think that has changed recently is I did a bundle update a couple days ago, so bundle got a minor version change (1.0.10 -> 1.0.21) and bcrypt appears to have gotten a major version change (2.1.4 -> 3.0.1).
Any help is appreciated!
Have you upgraded to Lion since you installed Ruby 1.9.2? If so it is probably linked to the wrong gcc.
Try uninstalling and reinstalling 1.9.2, I would suggest using rvm
rvm uninstall 1.9.2
rvm install 1.9.2
If that does not work you might have to implode rvm
rvm implode
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
rvm install 1.9.2
try:
sudo apt-get install build-essential

Resources