Comments (25)
I'm having the same issue.
from bundler.
Idem: http://gist.github.com/294420
from bundler.
Same here with Ruby 1.9.1
from bundler.
I'm having this same issue
from bundler.
So, I have no idea what actually is causing it. I spent a large amount of time debugging it and it's somewhere in Gem::Specification#method_missing.
I'm worried that it's some ruby bug. If somebody can find the source and submit a patch, i would be greatly appreciative.
from bundler.
I see this issue on Windows using 1.9.1 but not on Ubuntu using 1.9.1. (I'm not using RVM currently on Ubuntu)
from bundler.
hmm, @specification_version is nil when we come to method_missing... why??
from bundler.
So I've been digging and I found that the "undefined method '>' for nil:NilClass" is thrown in site_ruby/1.9.1/rubygems/specification.rb method_missing (line 531) because @specification_version is nil. This exception is caught in source_index.rb line 107 which dumps the spec code. I was able to mute the exceptions there but the real question is why isn't @specification_version being set for the specs loaded by bundler. I hope this is helpful. Let me know if I can help in any way.
from bundler.
Just to clarify the environment, it occurs without rvm.
To reproduce the problem:
$ mv ~/.rvm ~/_rvm (if you have rvm installed) (open a new shell if you've used rvm) $ svn co RUBY-TRUNK $ cd RUBY-TRUNK $ ./configure $ make $ sudo make install (if your shell requires) $ rehash $ which ruby /usr/local/bin/ruby $ ruby -v ruby 1.9.2dev (2010-02-06 trunk 26592) [x86_64-darwin10.2.0] $ sudo gem install bundler $ rehash (if your shell requires) $ gem list *** LOCAL GEMS *** bundler (0.9.3) minitest (1.5.0) rake (0.8.7) rdoc (2.2.2) $ mkdir testapp $ cd testapp $ echo 'gem "rake"' > Gemfile (fix cli.rb and add .to_s at the end) $ sudo vi +103 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-0.9.3/lib/bundler/cli.rb $ bundle exec ruby -e 1
from bundler.
I changed line 1038 of ruby's 1.9.1/rubygems/specification.rb
from
1038: required_attribute :rubygems_version, Gem::RubyGemsVersion
to
1038: puts '%s:%d' % [ __FILE__, __LINE__ ] 1039: k = Gem::RubyGemsVersion 1040: puts '%s:%d' % [ __FILE__, __LINE__ ] 1041: required_attribute :rubygems_version, k 1042: puts '%s:%d' % [ __FILE__, __LINE__ ]
and run the auctual command invoked when one run 'bundle exec ruby -e 1'.
$ RUBYOPT="-I/PATH/TO/gems/bundler-0.9.3/lib -rbundler/setup -rubygems" ruby -e 1
and got
/PATH/TO/ruby/1.9.1/rubygems/specification.rb:1038 WARNING: #' for nil:NilClass> # -*- encoding: utf-8 -*- [SNIP] WARNING: Invalid .gemspec format in '/PATH/TO/specifications/rake-0.8.7.gemspec' /PATH/TO/ruby/1.9.1/rubygems/specification.rb:1040 /PATH/TO/ruby/1.9.1/rubygems/specification.rb:1042
This means accessing constant Gem::RubyGemsVersion is the root of our problem, right? (autoload??)
from bundler.
I think that the error is in file "ruby/1.9.1/rubygems/source_index.rb", somewhere around line 109 of it.
Yep. Error is in this string:
gemspec = eval spec_code, binding, file_name
Last backtrace line is:
/var/opt/ruby/lib/ruby/1.9.1/rubygems/specification.rb:530:in `method_missing'
Error is because @specification_version is 'nil'
Full backtrace of error is:
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/specification.rb:531:in `method_missing'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/specifications/mime-types-1.16.gemspec:4:in `block in load_specification'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/specification.rb:421:in `initialize'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/specifications/mime-types-1.16.gemspec:3:in `new'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/specifications/mime-types-1.16.gemspec:3:in `load_specification'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:95:in `eval'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:95:in `load_specification'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:156:in `block (2 levels) in load_gems_in'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:155:in `each'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:155:in `block in load_gems_in'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:152:in `reverse_each'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:152:in `load_gems_in'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:348:in `refresh!'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:78:in `from_gems_in'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/source_index.rb:58:in `from_installed_gems'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems.rb:913:in `source_index'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/gem_path_searcher.rb:84:in `init_gemspecs'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/gem_path_searcher.rb:19:in `initialize'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems.rb:871:in `new'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems.rb:871:in `block in searcher'",
"<internal:prelude>:8:in `synchronize'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems.rb:870:in `searcher'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems.rb:528:in `find_files'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems.rb:1093:in `<top (required)>'",
"<internal:gem_prelude>:161:in `require'",
"<internal:gem_prelude>:161:in `load_full_rubygems_library'",
"<internal:gem_prelude>:273:in `const_missing'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/specification.rb:1038:in `<class:Specification>'",
"/var/opt/ruby/lib/ruby/1.9.1/rubygems/specification.rb:28:in `<top (required)>'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-0.9.2/lib/bundler/rubygems.rb:2:in `require'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-0.9.2/lib/bundler/rubygems.rb:2:in `<top (required)>'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-0.9.2/lib/bundler.rb:4:in `require'",
"/var/opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-0.9.2/lib/bundler.rb:4:in `<top (required)>'",
"config/boot.rb:6:in `require'",
"config/boot.rb:6:in `rescue in <main>'",
"config/boot.rb:2:in `<main>'"
from bundler.
yeah, so investigating the mechanism that @Specification remains nil.
from bundler.
I suppose that this issue isn't caused by Bundler, but by Rubygems.
I have Ruby HEAD (checked out from SVN and compiled by myself) and when I write in irb
require "rubygems/specification"
It shows the same errors.
from bundler.
hmm, I'll report this to ruby's redmine.
from bundler.
thread from ruby-core:345886 discusses this...
from bundler.
Posted: http://redmine.ruby-lang.org/issues/show/2717
from bundler.
Does following modification fix the problem?
At least, bundle exec ruby -e 1 succeeds.
- Edit lib/bundler.rb from
4: require 'bundler/rubygems'
to4: require 'bundler/rubygems-ext'
- Edit lib/bundler/rubygem.rb
from1: require 'rubygems' 2: require 'rubygems/specification'
to1: unless defined? Gem 2: require 'rubygems' 3: require 'rubygems/specification' 4: end
- Rename lib/bundler/rubygems.rb (Editted in 2.) to lib/bundler/rubygems-ext.rb.
This rename is because gem_prelude.rb of ruby 1.9 has following code.
if /#{Regexp.escape File::SEPARATOR}rubygems\.rb\z/ =~ path raise LoadError, "another rubygems is already loaded from #{path}" end
from bundler.
@sakuro: yes that fixed it for me.
from bundler.
I can confirm that it helps fixing the same issue in rails 3 too.
from bundler.
I've created a patch in my fork of bundler. Feel free to pull it in: http://github.com/ariejan/bundler
from bundler.
Applying the above fix from @Sakura worked to remove the gem spec errors but I'm still getting the "already initialized constant" errors. My output is here: http://gist.github.com/298503. Thanks for the help
from bundler.
re: "already initialized constant" errors
as pointed out by Balazs Nagy the "warning: already initialized constant" comes from Ruby cruft. removing the old library directory and starting with a fresh install removes those warnings.
note, this does not fix the verbose "Invalid .gemspec format in" warnings.
here's approximately what I did on OS X (snow leopard).
gem list --no-version > gem_list.txt sudo mv /usr/local/lib/ruby /usr/local/lib/ruby-old wget ftp://ftp.ruby-lang.org/pub/ruby/snapshot.tar.bz2 # install sudo su gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n gem install rails --pre gem install sqlite3-ruby env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config # install remaining gems
from bundler.
@trevor, Is there any way to install just the rubygems stuff? Your explanation makes it sound like it's a rubygems issue, not necessarily ruby itself. I'm running ruby 1.9.1 if that makes a difference.
from bundler.
from what i can tell ruby development has moved away from using the "site_ruby" directory. as i understand it "warning: already initialized constant" is happening because rubygems is being included twice.
in my problem-installation i can find rubygems in two separate places -
/usr/local/lib/ruby/1.9.1/rubygems /usr/local/lib/ruby/1.9.1/rubygems.rb /usr/local/lib/ruby/site_ruby/1.9.1/rubygems /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb
note they're not even the same files -
% diff -q /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb /usr/local/lib/ruby/1.9.1/rubygems.rb Files /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb and /usr/local/lib/ruby/1.9.1/rubygems.rb differ
on a clean install from ruby development, after making sure the old /usr/local/lib/ruby is moved elsewhere, i only get one instance of rubygems -
/usr/local/lib/ruby/1.9.1/rubygems /usr/local/lib/ruby/1.9.1/rubygems.rb
to answer your question there's likely a way to do it without having to reinstall ruby, but this seemed like the easiest way.
from bundler.
also see
http://github.com/carlhuda/bundler/issues#issue/51/comment/130069
from bundler.
Related Issues (20)
- Migrate current Linux CI matrix to Github Actions
- RUBY VERSION ruby 2.6.0p0 BUNDLED WITH 1.17.3 ``` --- TEMPLATE END ---------------------------------------------------------------- Unfortunately, an unexpected error occurred, and Bundler cannot continue. First, try this link to see if there are any existing issue reports for this error: https://github.com/bundler/bundler/search?q=%22&type=Issues If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
- Improve OpenSSL load failure message HOT 1
- Bundler 2.1.4 errors with different prefix for path source gems HOT 10
- i can't run bundle install HOT 2
- LoadError: cannot load such file -- <file_name> HOT 3
- CHANGELOG is out of date on master (does not mention 2.1.4) HOT 1
- config are stored to global when using `bundle config set --local` more than once HOT 3
- Bundle install got stuck on 'Resolving dependencies'
- Running Github Page Locally
- init_gems_rb setting is ignored in bundle-gem
- https://github.com/bundler/bundler/search?q=unknown+encoding+name+-+CP720&type=Issues
- gem install bundler - fails HOT 1
- (please ignore or delete this issue) HOT 1
- `cannot load such file -- did_you_mean` on `bunde install` with ruby-2.7.0 HOT 10
- Codeanywhere: Unfortunately, an unexpected error occurred, and Bundler cannot continue. HOT 1
- Gem::RemoteFetcher::FetchError: too many connection resets
- Gem::RemoteFetcher::FetchError: too many connection resets HOT 1
- Bundler removes more than it should HOT 1
- Bundle does not find gems after bundle install. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bundler.