This project is archived and is in readonly mode.

#3755 ✓stale

Gem.path is undefined when rack1.9.1 gems:unpack

Reported by dp | January 20th, 2010 @ 04:15 PM | in 2.3.10


  config.gem "thoughtbot-clearance",
   :lib     => 'clearance',
   :source  => '',
   :version => '0.8.2'
   $> rake1.9.1 gems:install

works fine - it installs clearance into ~/.gem , but

   $> rake1.9.1 gems:unpack

fails with error:

$ rake1.9.1 gems:unpack
(in /home/dp/rails/web )
ERROR:  While executing gem ... (NoMethodError)
    undefined method `path' for Gem:Module

ruby-debug says, that Gem.path became undefined on line

435         # return constants from from_mod's parents.
436         begin
437           return parent.const_missing(const_name)
438         rescue NameError => e

Some lines before, at line 423 Gem.path is correct ( ["/home/dp/.gem/ruby/1.9.1", "/var/lib/gems/1.9.1"] )
but search_for_file returns nil

423       file_path = search_for_file(path_suffix)

But if I do unpack by gem command - everything OK:

$ ls -dl thoughtbot-clearance-0.8.2
ls: cannot access thoughtbot-clearance-0.8.2: No such file or directory
$ gem unpack thoughtbot-clearance
Unpacked gem: '/home/dp/thoughtbot-clearance-0.8.2'
$ ls -dl thoughtbot-clearance-0.8.2
drwxr-xr-x 8 dp dp 4096 2010-01-20 17:02 thoughtbot-clearance-0.8.2

Comments and changes to this ticket

  • Tyler Rick

    Tyler Rick March 9th, 2010 @ 12:21 AM

    • Title changed from “Gem.path is nil when rack1.9.1 gems:unpack” to “Gem.path is undefined when rack1.9.1 gems:unpack”
  • Tyler Rick

    Tyler Rick March 9th, 2010 @ 12:35 AM

    I ran into the same problem. Attached is the patch I used to work around it (invoking gem command directly, like you did).

    Then I ran into the same problem with rake rails:freeze:gems. Here was my workaround for that:

    --- /var/lib/gems/1.9.1/gems/rails-2.3.5.orig/lib/tasks/framework.rake   2010-03-08 16:06:40.000000000 -0800
    +++ /var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/framework.rake   2010-03-08 16:35:25.000000000 -0800
    @@ -24,11 +24,18 @@
             chdir("vendor/rails") do
      { |g| deps.include? }.each do |g|
    -  ["unpack",, "--version", g.version_requirements.to_s])
    +  ["unpack",, "--version", g.version_requirements.to_s])
    +            command = ['gem', "unpack",, "--version", g.version_requirements.to_s].map{|a| a.gsub(/= /, '=')}.join(' ')
    +            puts command
    +            system command
    -["unpack", "rails", "--version", "=#{version}"])
    +["unpack", "rails", "--version", "=#{version}"])
    +          command = ['gem', "unpack", 'rails', "--version", version.to_s].map{|a| a.gsub(/= /, '=')}.join(' ')
    +          puts command
    +          system command
     "rails*").first, "railties")
           rescue Exception
  • Yehuda Katz (wycats)

    Yehuda Katz (wycats) March 27th, 2010 @ 10:51 AM

    • Milestone set to 2.3.6
  • Rizwan Reza

    Rizwan Reza May 16th, 2010 @ 02:41 AM

    • Tag changed from rake gems activesupport to rake gems activesupport, bugmash
  • Jeremy Kemper

    Jeremy Kemper May 23rd, 2010 @ 05:54 PM

    • Milestone changed from 2.3.6 to 2.3.7
  • Jeremy Kemper

    Jeremy Kemper May 24th, 2010 @ 09:40 AM

    • Milestone changed from 2.3.7 to 2.3.8
  • Jeremy Kemper

    Jeremy Kemper May 25th, 2010 @ 11:45 PM

    • Milestone changed from 2.3.8 to 2.3.9
  • Jeremy Kemper

    Jeremy Kemper August 30th, 2010 @ 02:28 AM

    • Milestone changed from 2.3.9 to 2.3.10
    • Importance changed from “” to “Low”
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:50 PM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:50 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket