This help site has been deprecated. Please send your requests to

ERROR: While executing gem ... (Errno::EINVAL) Invalid argument - c:

William's Avatar


15 Aug, 2010 09:34 PM

I have been having this issue over the last few weeks when ever I do any no local gem commands. See full example below:

I'm running Windows Vista SP1 v 2.1f and have installed the 1.9.1p429 from the Ruby Installer.

Any Help would be apperciated, thanks

### Start of commands ###

C:\tools\Ruby191\lib\ruby\site_ruby\1.9.1\rubygems>ruby -v
ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-mingw32]

C:\tools\Ruby191\lib\ruby\site_ruby\1.9.1\rubygems>gem -v

C:\tools\Ruby191\lib\ruby\site_ruby\1.9.1\rubygems>gem list --local

  *** LOCAL GEMS ***

C:\tools\Ruby191\lib\ruby\site_ruby\1.9.1\rubygems>gem update --system --debug
Exception `NameError' at C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:164 - uninitialized constant Gem::Commands::UpdateCommand
Exception `Gem::LoadError' at C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems.rb:779 - Could not find RubyGem test-unit (>= 0)

Updating RubyGems 
Exception `Errno::EINVAL' at C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:47 - Invalid argument -  c:
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument -  c:
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:47:in `stat'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:47:in `initialize'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:38:in `new'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:38:in `fetcher'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:168:in `block in which_to_update'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:161:in `each'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:161:in `which_to_update'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:75:in `execute'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:270:in `invoke'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:134:in `process_args'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:104:in `run'
        C:/tools/Ruby191/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:58:in `run'
        C:/tools/Ruby191/bin/gem:21:in `<main>'
  1. Support Staff 1 Posted by Nick Quaranto on 16 Aug, 2010 08:22 PM

    Nick Quaranto's Avatar

    Hi there...this seems pretty strange, and it definitely shouldn't happen. I would recommend installing Ruby via the RubyInstaller instead.

  2. 2 Posted by William Cherry on 16 Aug, 2010 10:58 PM

    William Cherry's Avatar

    Yeah, that's the way I did it both times. I had a slight older version
    (1.3.5) on another computer so I just copied over the whole Ruby directory
    and it's good again.

    Very strange, I was able to repeatably reproduce the issue on the laptop
    with the 1.3.7 version (Ruby 1.9.1p378 and Ruby 1.9.1p429).

    Ok, unless you have anything else for me to try; I'll say thank you for your

    On Mon, Aug 16, 2010 at 1:24 PM, Nick Quaranto <
    [email blocked]<tender%[email blocked]>
    > wrote:

  3. Support Staff 3 Posted by Nick Quaranto on 31 Aug, 2010 12:06 AM

    Nick Quaranto's Avatar

    Yeah, not sure. I would try Ruby 1.9.2 instead, now that it's stable. :)

  4. 4 Posted by Gavin on 07 Oct, 2010 12:36 AM

    Gavin's Avatar

    As per here "installation of RubyGems on
    top of RUby 1.9.2/1.9.3 is not supported."

    But it also does not work on Ruby 1.8.7? Maybe try 1.9.1?

  5. Support Staff 5 Posted by Nick Quaranto on 08 Oct, 2010 12:56 AM

    Nick Quaranto's Avatar

    Yeah, RubyGems comes with Ruby 1.9+ but you can still upgrade it. Is there still a problem here? Would love to close this out.

  6. 6 Posted by John on 03 Nov, 2010 07:01 AM

    John's Avatar

    To set up a ROR development environment in Windows 7 and test it by creating an application called blog using mysql for your database, perform the following steps exactly as outlined below:

    Download and install rubyinstaller-1.9.2-p0.exe from
    I installed mine to the default location (c:\ruby192).
    I also checked both check boxes about system path and associating files to ruby.
    You do not need to install rubygems separately. It is included in rubyinstaller-1.9.2-p0.exe.
    If you do install it separately, the below steps will not work. The only file you
    need to download and install is rubyinstaller-1.9.2-p0.exe. (Trust me.)

    Open command prompt

    Perform the below Run commands in your command prompt (do not type Run: or # comment... of course)

    Run: gem install rails # rails will install...takes a couple of minutes

    Run: gem install mysql # installs the mysql2 gem

    Open another command prompt

    Run: rails server # wait for server to start

    Open browser and open localhost:3000 in url field # checks that server works with Riding On Rails Page opening

    Run: cd 'to_where_ever_you_want_to_install_your_application' # where you want to create your blog application in next step

    Run: rails new blog -database=mysql # creates application named blog

    Run: cd blog # changes directory to your new application named blog

    open blog\config\database.yml in your text editor and correct mysql2 usernames and passwords if necessary and save file

    Run: rake db:create:all # creates all databases

    Run: rake db:migrate # checks database connection...ok if no complaint by rails

    Run: rails generate model Article # open blog\db\migrate###...###_create_articles.rb and make changes as follows and save file:
    class CreateArticles < ActiveRecord::Migration
    def self.up

    create_table :articles do |t|
      t.string :title                               # add this line
      t.text :body                                 # add this line
      t.datetime :published_at        # add this line


    def self.down

    drop_table :articles

    end end

    Run: rake db:migrate # creates articles table in blog_development database as per previous step

    Run: rails generate controller articles

    Run: rails generate scaffold Article title:string body:text published_at:datetime --skip-migration

    ** Open browser and open localhost:3000/articles in url field # should open blog web page Listing Articles

    Click on link "New Article" # should open page with form for entering article information

    All the above worked great for me! Good Luck!

  7. Support Staff 7 Posted by Nick Quaranto on 04 Nov, 2010 05:12 PM

    Nick Quaranto's Avatar

    Those instructions are probably better in a blog post somewhere :) Closing this one out for now.

  8. Nick Quaranto closed this discussion on 04 Nov, 2010 05:12 PM.

Discussions are closed to public comments.
If you need help with please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac