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

51 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
  22. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    apple service center | apple iphone service center | apple ipad service center | apple mac service center

    ReplyDelete
  23. Amazing Article ! I have bookmarked this article page as i received good information from this. All the best for the upcoming articles. I will be waiting for your new articles. Thank You ! Kindly Visit Us @ Coimbatore Travels | Ooty Travels | Coimbatore Airport Taxi | Coimbatore taxi

    ReplyDelete
  24. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Advanced AWS Training in Bangalore | Best Amazon Web Services Training Institute in Bangalore
    Advanced AWS Training Institute in Pune | Best Amazon Web Services Training Institute in Pune
    Advanced AWS Online Training Institute in india | Best Online AWS Certification Course in india
    AWS training in bangalore | Best aws training in bangalore

    ReplyDelete
  25. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article. thank you for sharing such a great blog with us.
    rpa training in bangalore
    rpa training in pune
    rpa online training
    best rpa training in bangalore

    ReplyDelete
  26. This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
    Best Devops online Training
    Online DevOps Certification Course - Gangboard
    Best Devops Training institute in Chennai

    ReplyDelete
  27. 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.
    online Python training
    python training in chennai

    ReplyDelete
  28. Good article and knowledge for me! I found a lot of information here!

    ReplyDelete




  29. Thanks For Sharing Your information Please keep updating us The Information Shared Is Very valuable Time Just Went On redaing The article Python Online Training Data Science Online Training Aws Online Training Hadoop Online Training

    ReplyDelete




  30. Thanks For Sharing Your information Please keep updating us The Information Shared Is Very valuable Time Just Went On redaing The article Python Online Training Data Science Online Training Aws Online Training Hadoop Online Training

    ReplyDelete
  31. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    linux Training in Chennai | Best linux Training in Chennai
    Unix Training in Chennai | Best Unix Training in Chennai
    Sql Training in Chennai | Best Sql Training in Chennai
    Oracle Training in Chennai | Best Oracle Training in Chennai
    Digital Marketing Training in Chennai | Best Digital Marketing Training in Chennai

    ReplyDelete