December 23, 2010

Installing Ruby Gems When On A Domain (Errno::ENOENT)

 

As someone who is new to Ruby I really love the idea of installing what you need for the language through gems. However, when I am at work I am on my company’s domain and when I try to install a gem I get the following error:

ERROR:  While executing gem ... (Errno::ENOENT)   
    No such file or directory - H:\

After searching for a solution to this problem, I believe I have found one.

The problem stems from the fact that logging into my domain at work changes my  %HOMEDRIVE% and %HOMEPATH% environment variables to my networked H:\ drive. To solve this problem you need to change your gem.bat.

The gem.bat file is located in your RubyFolder\bin folder. I would suggest that you first make a copy of the original before any tweaking of this file. What you are going to do is modify this file so that it changes the %HOMEDRIVE% and %HOMEPATH% before it tries to install the gem and then, when it is done, change those environment variables back to the original values. Below is an example of what you want this file to look like when you are done.

@ECHO OFF
SET _HOMEDRIVE=%HOMEDRIVE%
SET _HOMEPATH=%HOMEPATH%
SET HOMEDRIVE=C:
SET HOMEPATH=/Ruby192
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:/Ruby192/bin/gem" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*
SET HOMEDRIVE=%_HOMEDRIVE%
SET HOMEPATH=%_HOMEPATH%

In the above example, Ruby192 is where Ruby is installed.

So if you are stuck behind on a domain and cannot install a much needed Ruby gem, this solution will get you back in business in no time.

I cannot take credit for this solution so here are some places where I found this solution

36 comments:

  1. Thanks a lot, this post solved my problem!

    ReplyDelete
  2. 3 years after the above posted comment - This post solved my issue, too! :)
    Thank You.

    Grant

    ReplyDelete
  3. This blog gives the details about the job offers. This is very useful for job searchers. Here this blog helps to know about the job details. Thanks for this informative blog.
    PHP Training in Chennai

    ReplyDelete


  4. Great and useful article. Creating content regularly is very tough. Your points are motivated me to move on.


    SEO Company in Chennai

    ReplyDelete
  5. I just see the post i am so happy to the communication science post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be replay for your great thinks and I hope you post again soon...
    Java Training in Chennai

    ReplyDelete
  6. I read the post and I have really enjoyed and reading your blogs for these posts.looking for the next post.
    www.idigitalacademy.com

    ReplyDelete
  7. Here you Can Download Stock Note 4 Firmware Free With Full Speed

    sm-n910f firmware

    ReplyDelete
  8. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
    or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete
  9. Domain hosting wiki: for bloggers, business owners and webmasters looking for starting, maintaining and knowing more about domains and hosting
    Domain

    ReplyDelete
  10. REALLY VERY EXCELLENT INFORMATION. I AM VERY GLAD TO SEE YOUR BLOG FOR THIS INFORMATION. THANKS FOR SHARING. KEEP UPDATING.

    NO.1 SYSTEM INTEGRATION SERVICES | SYSTEM INTEGRATION MIDDLEWARE | MASSIL TECHNOLOGIES

    ReplyDelete
  11. Very good informative article. Thanks for sharing such nice article, keep on up dating such good articles.
    NO.1 API DEVELOPMENT SERVICES | MASSIL TECHNOLOGIES

    ReplyDelete
  12. Flex is one of the excellent open source web development applications that can be used to develop the highly rich as well as impressive internet applications.Edknt Media

    ReplyDelete
  13. Good Post! you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas of installing ruby gems.

    UI Developer Training

    ReplyDelete
  14. Very well written blog and I always love to read blogs like these because they offer very good information to readers with very less amount of words....thanks for sharing your info with us and keep sharing.


    java training in chennai | java training in bangalore

    java online training | java training in pune

    selenium training in chennai

    selenium training in bangalore

    ReplyDelete
  15. This is such a good post. One of the best posts that I\'ve read in my whole life. I am so happy that you chose this day to give me this. Please, continue to give me such valuable posts. Cheers!
    python training in pune
    python training institute in chennai
    python training in Bangalore

    ReplyDelete
  16. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. 

    Devops Training in pune
    DevOps online Training

    ReplyDelete
  17. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa interview questions and answers
    automation anywhere interview questions and answers
    blueprism interview questions and answers
    uipath interview questions and answers
    rpa training in chennai

    ReplyDelete
  18. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.


    AWS Training in Velachery | Best AWS Course in Velachery,Chennai

    Best AWS Training in Chennai | AWS Training Institutes |Chennai,Velachery

    Amazon Web Services Training in Anna Nagar, Chennai |Best AWS Training in Anna Nagar, Chennai

    Amazon Web Services Training in OMR , Chennai | Best AWS Training in OMR,Chennai

    ReplyDelete
  19. Woah this blog is wonderful i like studying your posts. Keep up the great work! You understand, lots of persons are hunting around for this info, you could help them greatly.

    Java training in Bangalore | Java training institute in Bangalore | Java course in Bangalore

    Java interview questions and answers

    Core Java interview questions and answers

    ReplyDelete
  20. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  21. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    excel advanced excel training in bangalore | Devops Training in Chennai

    ReplyDelete