18

Closed

installing rspec gem fails

description

igem install rspec leads to the following error message: "can't convert NilClass into String". This is with ironruby 1.1.1. It also means that the ruby gem project template fails when it tries to install the missing gems

file attachments

Closed Jul 28, 2011 at 5:05 PM by jimmysch
D:\iron-main\bin\Release>ir -S gem install rspecSuccessfully installed rspec-core-2.6.4Successfully installed diff-lcs-1.1.2Successfully installed rspec-expectations-2.6.0Successfully installed rspec-mocks-2.6.0Successfully installed rspec-2.6.05 gems installed

comments

davybrion wrote Oct 22, 2010 at 8:31 AM

sorry for the multiple edits btw, but codeplex seems to do some kind of auto postback when i press enter, so had some issues with merely filling out the description

imuzzolini wrote Oct 22, 2010 at 2:35 PM

I did the same from the command line (with IronRuby 1.1.1.0 on .NET 4.0.30319.1 ) but with different results; it seems like the gem installation completes successfully but "ri documentation" installation fails.
I attached the log.

ashmind wrote Oct 22, 2010 at 3:59 PM

Same error happens with rails gem for me, and mongoid (have not tried any others). Windows 7 x64.

gregslagell wrote Oct 22, 2010 at 7:27 PM

I'm getting the same thing with rails, rspec and various other gems I am trying to install.

rodrigovidal wrote Oct 23, 2010 at 4:26 AM

igem install rails -> fails to me too. "error message: "can't convert NilClass into String""

CDeutsch wrote Oct 24, 2010 at 12:23 AM

Most gems fail for me with the same error. I'm running Windows 7 64 bit.
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String

hudo wrote Oct 25, 2010 at 1:45 PM

same error when trying to igem install rails. Visual Studio gives warning about missing Path to IR, but it's set!

tacoman667 wrote Oct 25, 2010 at 5:07 PM

Mine fails as well. Rake installed but failed on documentation. Rails fails with the "can't convert NilClass into String" error. ARGH! I want to use this!

ShiftKey wrote Oct 26, 2010 at 10:55 AM

Seeing a similar issue on my environment - in VS and from console.
Log attached with environment info included.

eblumenfeld wrote Oct 28, 2010 at 11:32 PM

I'm having same exact problem with several gems...

jirapong wrote Oct 29, 2010 at 11:40 AM

Hi all... I'm investigate this issue... looks like it relate to rubygems version on IronRuby... single gem that has dependencies will fail. to workaround by install dependence gem one-by-one.

so.
run> igem.bat install rails -V --no-ri --no-rdoc

You will get error like this...
GET http://rubygems.org/quick/Marshal.4.8/json-1.4.6.gemspec.rz
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String
then you should install json first
run> igem.bat install json --no-ri --no-rdoc

Hope this help in the mean time.

tacoman667 wrote Oct 29, 2010 at 3:31 PM

Actually that doesn't work completely. I installed the 2 dependacies for actionmailer and actionmailer still throw the NilClass into String error. :(

hotgazpacho wrote Nov 4, 2010 at 2:52 AM

it would seem that the problem is with one of the dependent gems that rspec attempts to install. That is, I can successfully install rspec-core and rspec-expectations, but rspec-mocks fails with the "can'i convert NilClass to String". Willing to bet that its something within the gemspec that is triggering the error.

hotgazpacho wrote Nov 4, 2010 at 3:05 AM

Here's a backtrace:

C:\Users\Will>igem install rspec-mocks --backtrace --no-rdoc --no-ri
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/protocol.rb:133:in `rbuf_fill'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/protocol.rb:113:in `readuntil'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/http.rb:2213:in `read_status_line'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/http.rb:2202:in `read_new'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/http.rb:1185:in `transport_request'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/net/http.rb:1171:in `request'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/remote_fetcher.rb:342:in `request'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/remote_fetcher.rb:289:in `open_uri_or_path'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/remote_fetcher.rb:172:in `fetch_path'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/spec_fetcher.rb:241:in `load_specs'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/spec_fetcher.rb:214:in `list'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/spec_fetcher.rb:210:in `each'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/spec_fetcher.rb:210:in `list'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/spec_fetcher.rb:132:in `find_matching_with_errors'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/spec_fetcher.rb:70:in `fetch_with_errors'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/dependency_installer.rb:108:in `find_gems_with_sources'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/dependency_installer.rb:149:in `gather_dependencies'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/dependency_installer.rb:148:in `each'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/dependency_installer.rb:148:in `gather_dependencies'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/dependency_installer.rb:245:in `install'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/commands/install_command.rb:119:in `execute'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/commands/install_command.rb:116:in `each'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/commands/install_command.rb:116:in `execute'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/command.rb:270:in `invoke'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/command_manager.rb:134:in `process_args'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/command_manager.rb:104:in `run'
    C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/rubygems/gem_runner.rb:58:in `run'
    C:/Program Files (x86)/IronRuby 1.1/bin/gem:25

tonyheupel wrote Nov 5, 2010 at 5:28 PM

Same issue for me when trying File->New Ruby on Rails Project or Sinatra project, and it is trying to install the gems. Also get can't convert NilClass into String error both within VS and on the console.

thedo666 wrote Nov 6, 2010 at 3:49 PM

On WinXP Clean install :(

igem install rspec --verbose
GET http://rubygems.org/latest_specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
GET http://rubygems.org/quick/Marshal.4.8/rspec-2.0.1.gemspec.rz
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String

thedo666 wrote Nov 6, 2010 at 3:50 PM

igem install rspec --verbose
GET http://rubygems.org/latest_specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
GET http://rubygems.org/quick/Marshal.4.8/rspec-2.0.1.gemspec.rz
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String

thedo666 wrote Nov 6, 2010 at 3:50 PM

igem install rspec --verbose
GET http://rubygems.org/latest_specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
GET http://rubygems.org/quick/Marshal.4.8/rspec-2.0.1.gemspec.rz
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String
WinXP Clean Install

TomasMatousek wrote Nov 14, 2010 at 9:13 PM

This was caused by MRI 1.9.2 incompatibility. Non-blocking IO operations raise Errno::EWOULDBLOCK exception object that is extended by IO::WaitReadable. The mixin was missing in IronRuby.
Fixed will be available in git repo as soon as github comes online (it's down right now).

dylanbeattie wrote Nov 15, 2010 at 11:45 PM

I'm getting the same error. Just cloned the latest source from Github, built the MSI from source and installed it.

Trying to run igem install rspec --verbose gives me:

C:\Program Files (x86)\IronRuby 1.1\bin>igem install rspec --verbose
GET http://rubygems.org/latest_specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rspec-core-2.1.0.gemspec.rz
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String
C:\Program Files (x86)\IronRuby 1.1\bin>
  • and as others have noted, this means I can't use the Ruby Gem template in VS2010 because it fails with the same error.
Trying the workaround in the thread comments produces:

C:\Program Files (x86)\IronRuby 1.1\bin>igem.bat install json --no-ri --no-rdoc
ERROR: While executing gem ... (Errno::EACCES)
C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems


jirapong wrote Nov 16, 2010 at 1:33 AM

I don't have a chance to update Tomas's patch yet, but look like it very close to what i was investigate. other issue should be the timeout handling was wrong. since if you keep trying to run same gem, randomly it success.

tacoman667 wrote Nov 18, 2010 at 2:10 PM

I just built from a fresh pull from github but I still get the NilClass error when installing rails.

kazimanzurrashid wrote Nov 21, 2010 at 2:47 AM

I could find a resolution still the issue is marked as fixed, what is the patch?

jackukleja wrote Nov 22, 2010 at 3:23 AM

I am also getting the following error:
Creating Rails app WebApp6 in c:/users/John/documents/visual studio 2010/Projects/WebApp6 ...
Installing missing gems: rails (3.0.1), activerecord-sqlserver-adapter (3.0.2)
can't convert NilClass into String
WARNING: You don't have C:/Users/John/.gem/ironruby/1.9.1/bin in your PATH,
  gem executables will not run.
Successfully installed activerecord-sqlserver-adapter-3.0.2

CDeutsch wrote Nov 23, 2010 at 5:38 PM

Yep, still getting the error. Just built latest from GitHub too.
Error:
Installing missing gems: rails (3.0.1), activerecord-sqlserver-adapter (3.0.2)
can't convert NilClass into String

jirapong wrote Nov 29, 2010 at 4:19 PM

Hi Tomas,
I have latest source from new repos to build and try "igem install paperclip --debug --no-ri" for testing. It still a problem, however it looks better for other gems. I got more information here. on C:/github/ironruby/Languages/Ruby/StdLib/ruby/1.9.1/rubygems/remote_fetcher.rb#289

289 response = request uri, fetch_type, last_modified
290 if (response.nil?)
291 puts "This should not be nil: #{uri}, #{fetch_type}" << My debug code
292 end
293
294 case response
295 when Net::HTTPOK, Net::HTTPNotModified then
296 head ? response : response.body
297 when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
298 Net::HTTPTemporaryRedirect then
299 raise FetchError.new('too many redirects', uri) if depth > 10
300
301 open_uri_or_path(response['Location'], last_modified, head, depth + 1)
302 else
303 raise FetchError.new("bad response #{response.message} #{response.code}", uri)
304 end

So, actually the request method should alway return response in the two cases NOT nil. and i still believe there is something to do with read_nonblock method.

idondis wrote Dec 10, 2010 at 1:40 AM

I was wondering if this issue is resolved or has a workaround? I am getting the following error for rails and virtually most other gems I tried to install.


c:\Program Files (x86)\IronRuby 1.1\bin>igem install rails --version 3.0.1 -V --no-ri --no-rdoc
GET http://rubygems.org/specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
GET http://rubygems.org/latest_specs.4.8.gz
ERROR: While executing gem ... (TypeError)
can't convert NilClass into String
c:\Program Files (x86)\IronRuby 1.1\bin>

smithd98 wrote Dec 13, 2010 at 3:25 AM

I just installed 1.1.1 and I get this error in Visual Studio when trying to create a new GEM:

Creating Gem runner_gem in C:/projects/IronTester ...
Installing missing gems: rspec (1.3.0)
0 gems installed
can't convert NilClass into String

vcr2 wrote Dec 17, 2010 at 9:53 PM

Is this really fixed? I have the same problem when trying to install rspec, cucumber, and almost all other gems, in three different computers.

One person in this thread said the recent versions of ironruby are correct (EWOULDBLOCK), but I've run 1.1.1 and the github master, the same problem happens in both.

Is there any configuration missing?

ddwelle wrote Jan 11, 2011 at 3:18 PM

Still getting error with latest bits. win7 x64.

bravekao wrote Jan 22, 2011 at 4:58 AM

the same error happened when i creating new project
Creating Rails app WebApp1 in F:/WorkHistory/my_gem2 ...
Installing missing gems: rails (3.0.1), activerecord-sqlserver-adapter (3.0.2)
can't convert NilClass into String
can't convert NilClass into String0 gems installed

MagmaiKH wrote Feb 11, 2012 at 10:58 PM

I encountered a lot of non-sense getting this setup and working on Windows 7 x64.

The default installation location of C:\Program Files (x86)\IronRuby 1.1\ appears to cause problems.
Install to C:\IronRuby instead (I think it's the spaces in the path.)
Ensure your environment path includes C:\IronRuby\bin
Close any processes (cmd-shell or MSVC) and relaunch them as administrator.
This will pick-up the new environment path and change the security-whatever to admin.
Then it is possible to successfully install gems and will cut down on many nil-string errors.

The latest rails does not work with IronRuby because the latest json gem uses native C.
See https://github.com/rails/rails/issues/3413
Install rails 3.0.8 as a work-around:
igem install rails -v 3.0.8 -V --no-ri --no-rdoc
This will be -V[erbose] so you'll see what actually fails.
Dump the ri & rdoc, you don't need them (even if they'd be "nice to have").
I just setup a new PC and just did this (2-11-2012) and it works.

Alternatively one could try hacking the rails gem and change the require from json to json_pure (which does not use any native-C).

I'm pressing on with v3.0.8 for now.
Once I learn how all of this web stuff works and the basics of my site working I may take a look at the daunting task of adding native-C support to IR. Windows ~does~ have a POSIX sub-system that can be installed as a component though it is based on BSD, results may be fast/better achieved leveraging cygwin.