Created
June 2, 2011 16:59
-
-
Save anlek/1004807 to your computer and use it in GitHub Desktop.
Getting a bignum too big to convert into `long' (RangeError) when running Bundle install on your server? Here is how I solved it with the help from evan on the bundler IRC channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/local/lib/site_ruby/1.8/rubygems/requirement.rb:109:in `hash': bignum too big to convert into `long' (RangeError) | |
from /usr/local/lib/site_ruby/1.8/rubygems/requirement.rb:109:in `hash' | |
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:1306:in `hash' | |
from /usr/lib/ruby/1.8/open-uri.rb:32:in `inject' | |
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:1305:in `each' | |
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:1305:in `inject' | |
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:1305:in `hash' | |
from /usr/lib/ruby/1.8/tsort.rb:181:in `include?' | |
from /usr/lib/ruby/1.8/tsort.rb:181:in `each_strongly_connected_component' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:124:in `tsort_each_node' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:124:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:124:in `tsort_each_node' | |
from /usr/lib/ruby/1.8/tsort.rb:180:in `each_strongly_connected_component' | |
from /usr/lib/ruby/1.8/tsort.rb:148:in `tsort_each' | |
from /usr/lib/ruby/1.8/tsort.rb:135:in `tsort' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:107:in `sorted' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:12:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb:49:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb:8:in `install' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/cli.rb:222:in `install' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/task.rb:22:in `send' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/task.rb:22:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor.rb:246:in `dispatch' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/base.rb:389:in `start' | |
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/bin/bundle:13 | |
from /usr/bin/bundle:19:in `load' | |
from /usr/bin/bundle:19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Solution: | |
Edit /usr/local/lib/site_ruby/1.8/rubygems/version.rb (your location may very) | |
Near line 217 you should see: | |
def hash # :nodoc: | |
@hash ||= segments.hash | |
end | |
Remove the "@hash ||=" so your code should look like this: | |
def hash # :nodoc: | |
segments.hash | |
end | |
Save the file. | |
Run your bundler install call again. It should NOT fail. | |
Now you can go back and re-enable the caching of @hash | |
Edit /usr/local/lib/site_ruby/1.8/rubygems/version.rb around line 217 and put back: | |
def hash # :nodoc: | |
@hash ||= segments.hash | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -v | |
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-linux] | |
gem -v | |
1.8.5 | |
bundle -v | |
Bundler version 1.0.14 |
See http://revision-zero.org/history-of-a-bug for an alternative solution and discussion of the bug.
Thanks, I have read that before and maybe it was a bad version of Ruby. However someone help me figure out that it was because I had about 3 different versions of ruby installed (not using RVM at all). I just had to start a fresh server and installed RVM and used it to install versions of ruby. All is well now
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems error comes back with time. Leaving out the @hash ||= will make it continue to work. However this does make installing gems a bit longer and uses a bit more CPU.