Ruby Bundler attempts to resinstall already installed Gem - ruby

I had to uninstall and rebuild json gem on my Windows machine, because the gem that was installed originally caused NoMethodError (described here).
I issued the following commands:
gem uninstall json --all
gem install json --platform=ruby
This built json 1.4.6 and everything worked fine. However, later I issued a bundler command:
bundle update
I saw that Bundler reported "installing json (1.4.6)". After that the error came back, so I had to re-install json again.
I wonder what causes Bundler to reinstall the gem that is already present on the system with matching version number.

The reason is that bundler attempts to install the binary version of json for your platform, while you manually installed the ruby platform one (I believe to workaround other issues of JSON gem)
I will recommend you uninstall json gem that gets installed by bundler after your update.
bundle update
gem uninstall json --platform=x86-mingw32
Also raise this bug to Bundler developers in their issue tracker and their mailing list
Sorry for not been more helpful, but there is no known answer to your issue.

Related

Installing into parent path not allowed when installing locally built Ruby gem

I've written a Ruby gem that I'd like to install locally. I'm using Rubygems 3.0.6 and RVM on OS X Mojave. This is a closed source gem and I'd rather not go to the trouble of publishing it to the company gemservers. I'm able to install other (published) gems just fine using both bundle install and gem install.
The gem is all built (using gem build) and the code works, but when I run:
gem install influx_trello_utility-0.1.0.gem
I get an error:
ERROR: While executing gem ... (Gem::Package::PathError)
installing into parent path /bin/[ of /Users/danascheider/.rvm/gems/ruby-2.6.3#influx_trello_utility/gems/influx_trello_utility-0.1.0 is not allowed
Any help with this would be much appreciated. I'm not sure what additional information would be useful, but I'm happy to answer any questions you may have. Thanks!

Bundle install fails, Gem install succeeds

When trying to bundle install on a Gemfile that contained only the GitHub Pages gem and nothing else, on Ubuntu 18.04, I got error messages telling me to try installing eventmachine using gem install. That always succeeds, but bundle install still fails. How can I get bundler to see that the gem is installed?
I fixed this after many hours of struggle, by noticing that on the GitHub Pages repo there's a note that says
Important: Make sure you have Bundler > v1.14 by running gem update bundler in your terminal before following the next steps.
I have no idea why this mattered but I removed my ruby packages from Ubuntu and reinstalled them, then installed bundler with rubygems, which gave me a newer version:
sudo apt-get remove ruby
sudo apt-get install ruby ruby-dev
sudo gem install bundler
bundler --version
If anyone knows why I needed that version of bundler, or how I should have diagnosed this faster, I'd be interested to hear it. I'm not new to programming but I'm new to Ruby.
From my understanding it might be the gem you are trying to install requires a specific feature provided by bundler. If you check the change log of bundler there is some changes related to install github based gems on how to correctly read the user git settings. So I think that might be where the problem is from.

Bundle Install not installing the gems from gemfile

I am trying to setup my rails application on Windows 7 machine. I installed Ruby 1.9.3 by using installer. I also installed Rails 3.2.2.
Now, I am trying to run bundle install from my application root directory. This command used to install all the required gems. However, when I am running in this new machine its not installing. I have to install all the gems manually one by one.
I know its bit strange but I am facing this for the first time..!!
Edit 1: Please refer below screen-shot.
Note: I have already installed few gems manually before posting here. The error related to DevKit that I am getting below has just came while I was tried to install json gem..
After Installing more gems manually:
If you read the error, it tells you that you need DevKit to install that gem on Windows. So install that and follow the instructions, then try again ;) After the json gem can be installed, it should install every other gem in the Gemfile.
(The json gem is a dependency from Rails)

Problems with RubyGems

I'm having some problems with ruby gems. I'm trying to install the gem hitimes although after trying to install it (even using sudo) I get this error: http://cl.ly/Hvlf.
Could it be that I already have it installed because I've tried a few times now. Is there a way to uninstall a gem?
The gem can be found here on RubyGems.org and I've even tried to download the .gem file and install it that way but had no luck.

Installing Sproutcore with RubyGems fails at the haml gem

I am trying to install sproutcore on a windows xp vm (virtualbox), for development, using RubyGems. When gems reaches haml-3.0.25.gem it stops with the error:
gem install sproutcore -V
...
ERROR: While executing gem ... (Zlib::DataError)
invalid stored block lengths
I have tried both Ruby 1.8.7 and 1.9.2 as well as RubyGems 1.7.1 and 1.8.1.
I tried downloading haml 3.1.1 with git and installing it manually, but the rake would not install. It said something about 'lib/haml' not found. The directory did exist.
Other gems install just fine under all the combinations I tried. I even tried installing it under my host OS (Win 7 32-bit), but it gave the same error. Installing haml by itself changes the error message only slightly:
gem install haml -V
...
ERROR: While executing gem ... (Zlib::DataError)
invalid code lengths set
Zlib compresses and decompresses data streams from what I have read, so it sounds like the haml gem might be corrupt (although I doubt).
I am at my wits end and could find no helpful advice anywhere.
Special thanks to #saner for his contribution. After a lot of frustration, this is how I finally installed sproutcore on a Windows XP VM running on a Windows 7 host.
1) Download and install Ruby 1.9.2-p180 (remember to tick the option to include the bin directory in the PATH variable).
2) Download DevKit 4.5.1 and extract it.
3) Open a command prompt and cd to the extracted directory.
4) Run:
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
5) Download RubyGems 1.7.2 and run setup.rb
6) From the command prompt run
gem install haml -v 3.0.24
gem install eventmachine --pre
gem install sproutcore --pre
Thats it.
Enjoy.
I was able to install SproutCore on Ruby 1.9.2:
Install Ruby 1.9.2-p180
gem install sproutcore --pre
gem install eventmachine --pre
gem uninstall thin
gem install mongrel
I needed to remove thin because starting sc-server ended with errors, SproutCore will use mongrel instead of thin.
Update:
I didn't mention that I use RubyGems 1.7.2 and I have installed DevKit and Cygwin.
I removed all versions of SproutCore, Mongrel and Haml, then I typed:
gem install sproutcore --pre, SproutCore v1.6.0.beta.1 was installed.
eventmachine --pre, eventmachine (1.0.0.beta.3 x86-mingw32) was installed
SproutCore works with this setup, using mongrel was not necessary.
My configuration: sproutcore (1.6.0.beta.1), ruby 1.9.2p180, gem 1.7.2, thin (1.2.11 x86-mingw32), eventmachine (1.0.0.beta.3 x86-mingw32), haml (3.0.25), gcc version 4.5.0 (GCC)
I know this is a really old question, but since I just experienced the same problem, I've decided to add my insights on it.
So, it happened while I was trying to install the same set of gems on two different machines with different architectures, with different locations and respectively in different networks. I.e. - my home mac and a remote linux server.
So, one particular gem (dm-sqlite-adapter) failed installing on both machines, and I even tried it couple of times, but always with the same result:
$ gem install dm-sqlite-adapter
ERROR: While executing gem ... (Zlib::DataError)
invalid code lengths set
Then I spent few minutes browsing the network for a solution, including reading this thread.
Since I didn't find any satisfying answer and I wasn't pleased with the idea of reinstalling everything, decided to act dumb and tried gem install one more time.. And it worked. Then tried the other machine - worked like a charm.
So as a conclusion I'd just guess that the problem came from the remote repo and maybe the gem hadn't even downloaded at all (I forgot to check that prior to succeeding installing it). But as I said - it's just a guess..

Resources