Valid types are [:development, :runtime], not nil #592

Closed
mperham opened this Issue Aug 19, 2010 · 22 comments

Projects

None yet
@mperham
mperham commented Aug 19, 2010

When I try to start my rails 3.0rc app:

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
from /Users/mike/.rvm/gems/ruby-1.9.2-p0@foundation/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:355:in `new'
from /Users/mike/.rvm/gems/ruby-1.9.2-p0@foundation/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:355:in `search'
from /Users/mike/.rvm/gems/ruby-1.9.2-p0@foundation/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:181:in `resolve'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/source_index.rb:95:in `sort_by'

Note the rubygems code is running from 1.8 while I'm trying to use 1.9.2 from RVM!?

Gemfile:

source :rubygems

gem 'rails'
gem 'devise', :git => 'git://github.com/plataformatec/devise.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'capistrano'
gem 'capistrano-ext'
gem 'memcache-client'
gem 'mysql2'

gem 'admin_data', :git => 'git://github.com/neerajdotname/admin_data.git', :branch => 'rails3_gem'
gem 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :branch => 'rails3'

gem 'rack-bug', :require => 'rack/bug', :git => 'git://github.com/brynary/rack-bug.git', :branch => 'rails3'

group :test do
  gem 'factory_girl_rails'
  gem "rspec-rails", ">= 2.0.0.beta.19"
  gem "steak", '0.4.0.beta.1'
  gem 'vcr'
  gem "capybara"
  gem "launchy"
  gem 'mocha'
  gem 'less'
end
@titanous

I have the exact same issue.

@ajwalters

Same here. If i edit line 355 of lib/bundler/resolver.rb and remove the splat *, it seems to work.
ie- Change
d = Gem::Dependency.new(base.first.name, *[dep.requirement.as_list, base.first.version].flatten)

to
d = Gem::Dependency.new(base.first.name, [dep.requirement.as_list, base.first.version].flatten)

If i can actually get the bundler specs to run on my machine, i'll see if this breaks anything else and submit a patch

@ajwalters

Here's my commit which seems to have resolved the issue for me. Pull request sent. http://github.com/ajwalters/bundler/commit/1636a7c312672ab8ebee4f1ae35d4484043272e0

@antw
antw commented Aug 22, 2010

I just encountered the same issue while setting up Bundler with a Sinatra app; I ran rackup config.ru and received the error mentioned above.

It turns out that after installing rack the new rackup executable hadn't been picked up by the terminal. Running rackup would instead try to run the version included with OS X, which in turn loaded the wrong version of RubyGems. Opening a new terminal solved the problem.

My $LOAD_PATH, before and after: http://gist.github.com/543840

@heisee
heisee commented Aug 23, 2010

Hi,

another temporary workaround is to delete Gemfile.lock every time the server starts up. Therefor I simply put

require "fileutils"

FileUtils.rm_f("Gemfile.lock")

at the beginning of config/preinitializer.rb of my Rails 2.3.8 app.
I can also confirm that the patch of ajwalters seems to work in my case (instead of deleting the file)

Heiko

@QuBiT
Contributor
QuBiT commented Aug 23, 2010

I had the same problem (3.0.0.rc, ruby 1.8.7)

Valid types are [:development, :runtime], not nil

solved it by installing ajwalters's bundler version (until this is solved) and applying the patch.

@mechfish

Had the same problem, solved by ajwalters's patch.

@ajwalters

Just an update, when updating to Rails 3 rc2, I couldn't run bundle update rails. It would fail out (maybe because of my patch, who knows). But I uninstalled my patched version of bundler, installed bundler rc6, and was able to update everything fine. I'm also not receiving the issue described in this ticket anymore when i do rails * commands. Thought it would be beneficial for others to know. Living on the edge is fun... :-)

@QuBiT
Contributor
QuBiT commented Aug 27, 2010

I can confirm that using 1.0.0.rc.6 and rails 3.0.0.rc2 the issue is gone.

@mechfish

I'm not using Rails at all; I'm using Capistrano and calling bundle/setup at the start of a Capfile.

However, I just went to try and replicate my problem so that I could argue that we still need to fix this bug. And, um, I can't replicate the problem today. So, problem miraculously solved? ;)

@bjeanes
bjeanes commented Aug 30, 2010

I can confirm that this is still occurring in Bundler 1.0.0 final. I have tested it in a rails 2.3.8 app and a rails 3.0.0.rc.2 (haven't tested final) on ruby-1.8.7-p249 with RVM --head. It occurs both in ZSH and Bash and the http://github.com/ajwalters/bundler/commit/1636a7c312672ab8ebee4f1ae35d4484043272e0 fix has been applied to no effect.

@bjeanes
bjeanes commented Aug 30, 2010

Interesting ...

The cause for me was that my RVM ruby's rake executable file was hardcoded to use the system ruby:

$ head /Users/bjeanes/.rvm/gems/ruby-1.8.7-p249@test_project/bin/rake
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'
@indirect
Member

Sounds like you were bitten by a bug in an old version of RVM. You can read more about how it was found and fixed on Yehuda's blog: http://yehudakatz.com/2010/08/24/a-tale-of-abort-traps-or-always-question-your-assumptions/

@QuBiT
Contributor
QuBiT commented Aug 30, 2010

one remark:

i had the problem WITHOUT rvm (using passenger and ruby 1.8.7 and rails 3.0.0.rc) (see above)

@indirect
Member

@QuBiT, yes, it seems like this was actually two different bugs, but they both seem resolved now, so yay.

@joel1di1
joel1di1 commented Oct 1, 2010

@indirect : thanks, I had the same problem and a 'rvm update' solved it :D

@skippy
skippy commented Apr 28, 2011

I'm seeing this issue on a unix box with the following:
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2011.03

$ bundle -v
Bundler version 1.0.12

gem -v
1.7.2

FYI

@sgerrand
sgerrand commented Jul 6, 2011

Same issue here on Linux.

$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2011.02

$ bundle -v
Bundler version 1.0.15

$ gem -v
1.5.2

@gravis
gravis commented Jul 13, 2011

Still having this issue, but only when using tmux+vim (don't know why yet, vim without tmux is fine).

ruby -v 
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0] 

bundle -v
Bundler version 1.0.15 

gem -v 
1.6.2

rvm -v
rvm 1.6.22 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/] 
@sgerrand

Actually, the issue I had was related to the path environment variable. Precedence had to be set to the path where the Ruby version was used is installed.

@bullandvodka

Where is the solution?

@santuxus
santuxus commented Dec 5, 2011

I had the same error - in my case it was related to rubygems version...

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment