RubyGems issue on OS X Lion - ruby

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'

Related

An error occurred while installing pg (1.0.0), and Bundler cannot continue

I'm trying to deploy Zipsell with heroku. However when I run through the heroku and ruby setup and try to deploy via:
git clone https://github.com/yongfook/zipsell
cd zipsell
./bin/setup
I get the error message:
An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that gem install pg -v '1.0.0' --source 'https://rubygems.org/' succeeds before bundling.
In Gemfile:
pg
I have run through the setup process now multiple times and reinstalled all but still am not able to deploy. Any idea what is going wrong?
From the repo you posted it seems the error message is very clear. From the Gemfile of the repo you shared it seems you haven't install pg which is the postgresql (You will need to remove sqlite.
The problem is that there are some missing dependencies that you don't have installed and that why the error is thrown. There is the concepts of gems which is packaged code. https://rubygems.org/ via the following website you can find some of the gems you'r missing. There is also the versions which have to be compatible.
What you'll do is search for the missing gems shown in the error message. Check for the correct version if you the gem in your Gemfile but the version is conflicting.
https://github.com/yongfook/zipsell/blob/master/Gemfile
bundle update
install the missing gems
gem install pg
and so on. Or do it straight in the Gemfile.

Error while installing the mimemagic in rails

I am using rails 4.2.4 and try to install paperclip gem in my application. After editing my gem file when I run bundle install.Then I got the error.
Bundler::GemspecError: Could not read gem at /home/darkpasenger/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/mimemagic-0.3.0.gem. It may be corrupted.
An error occurred while installing mimemagic (0.3.0), and Bundler cannot continue.
Make sure that gem install mimemagic -v '0.3.0' succeeds before bundling.
So I run the command gem install mimemagic -v '0.3.0.Then again I got the error.
ERROR: Error installing mimemagic:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/darkpasenger/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/mimemagic-0.3.0.gem
Please help me out to fix this problem.
I found the answer here: https://programmerah.com/mimemagic-0-3-10-install-error-and-bundler-cannot-continue-26830/
but I have pasted the steps in case the link stops working.
brew install shared-mime-info
bundle install
These two commands fixed the issue for me.
fissh
These two commands fixed the issue for me.
brew install shared-mime-info
bundle install
But i need to run first this command sudo chown -R $(whoami) $(brew --prefix)/* because brew install shared-mime-info is failed in my system with the error permission denied #rb_file_s_symlink
Try deleting this file from the system
/home/darkpasenger/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/mimemagic-0.3.0.gem
and then try installing the gem again. It seems that the gem was not properly downloaded.

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.

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.

An error occurred while installing libv8 (3.11.8.13), and Bundler cannot continue

After run bundle install I get this error:
Gem::Package::FormatError: no metadata found in /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem
An error occurred while installing libv8 (3.11.8.13), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.13'` succeeds before bundling.
I try with
gem install libv8 -v '3.11.8.13'
But I get
ERROR: Error installing libv8:
invalid gem format for /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem
What is the problem here. Please some help.
The Gem::Package::FormatError: no metadata found in ... error message indicates that the content of Ruby's cache directory gets out of sync with the actual gem repository.
The error can be fixed by removing either the offending file or the complete cache folder, and running bundle install again.
First try removing the offending file:
rm ~/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem
bundle install
That should fix the problem. If it doesn't, remove the complete cache folder:
rm -rf ~/.rvm/gems/ruby-1.9.3-p286/cache/
bundle install
Ref:
Rails: Fixing Bundle “No Metadata Found” issues
Bundler issue : No metadata found
SO answer to RubyGems issue on OSX
Additionally, it might be worth updating rubygems version with gem update --system as mentioned in this answer

Resources