I'm new to programming and am trying to set up Ruby on Rails using Michael Hartl's tutorial via Terminal on a Mac running Snow Leopard, but I'm a bit stuck on this part. I've tried using rvm 1.9.2, without any luck, and haven't been able to find anything googling. Any help would be appreciated!
Thanks!
CZom$ gem install rails -v 3.2.3
/Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `read': Is a directory - /Users/CZom/.gemrc (Errno::EISDIR)
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `load_file'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:191:in `initialize'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/bin/gem:25:in `<main>'
/Users/CZom/.gemrc should be a user specific config file that gets loaded when executing the gem command. Sounds like in your case it is a directory instead. Rubygems is complaining therefore.
Try to rename /Users/CZom/.gemrc or remove it completely if it isn't needed.
Related
I'm getting this error when trying to run the gem command. Does anyone know what is causing this? It's causing me to be not able to run rails g migration commands (I get a similar error), and I'd imagine probably a lot more.
Error loading RubyGems plugin "/Users/storwell/.rvm/gems/ruby-2.0.0-p247#global/gems/executable-hooks-1.2.2/lib/rubygems_plugin.rb": undefined method `stubs' for Gem::Specification:Class (NoMethodError)
/Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:255:in `matching_specs': undefined method `stubs' for Gem::Specification:Class (NoMethodError)
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:279:in `to_specs'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:572:in `load_yaml'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:327:in `load_file'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:196:in `initialize'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `new'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:39:in `run'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/bin/gem:21:in `<main>'
Update: I've also tried the rake command and it throws the same error.
I found an older link related to the same problem
, and it seems that it might be either a (1) Ruby installation issue, or (2) RubyGem issue. If it a Ruby issue, you need to uninstall and reinstall Ruby by using RVM (Ruby Version Manager) it seems that it worked for some. If it's (2) RubyGem issue (which it probably is), you either have to delete '/Users/storwell/.rvm/gems/ruby-2.0.0-p247#global/gems/executable-hooks-1.2.2/' folder or change the content in rubygems_plugin.rb file.
One of the users suggested (you can find from the link):
*"When I use "gem -v", the response will give me the error "Error loading RubyGems plugin "/Users/mercury/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.2.8/lib/rubygems_plugin.rb": cannot load such file -- rubygems_bundler/rubygems_bundler_installer (LoadError)
So I edit "rubygems_plugins.rb", and I change the require path of rubygems_bundler, the path after modified is "./rubygems_bundler/{file_name}", and the problem solved."*
I hope these instructions + link will help you to solve the problem. I did go through the same tutorial book by Michael Hartl last summer. I think I have encountered a similar issue. I think I might have deleted one folder in order solve the issue, and perhaps reinstalled something as well (but I am not 100% because it has been a while) .
Try calling
$gem update --system
This question already has an answer here:
Trying to install rails- EISDIR error
(1 answer)
Closed 9 years ago.
I have installed Ruby successfully, RVM, rbenv, homebrew, git, and i've tried to install Rails in so many ways (hopefully i didn't mess anything up) but every time i try to do:
gem install rails
I get the following:
/usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/rubygems/config_file.rb:253:in `read': Is a directory - /Users/MARS/.gemrc (Errno::EISDIR)
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/rubygems/config_file.rb:253:in `load_file'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/rubygems/config_file.rb:191:in `initialize'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/bin/gem:21:in `<main>'
I don't understand what this means and i'm just not sure what else i need to do to get Rails. 4.0.0 installed.
Any help or advice would be greatly appreciated.
The error says cleanly: Is a directory - /Users/MARS/.gemrc (Errno::EISDIR), and .gemrc file placed in your home folder MUST be a file, not a folder. So either make it a file, or remove folder with such name.
Versions, dependencies, and other information:
Ruby: 1.9.3p392 (2013-02-22) [i386-mingw32]
Rails: 3.2.13
Gemfile located at: http://pastebin.com/z9u40Jca
For some reason, whenever I run any gem based command, it gives me this error:
$ rails s
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/rubygems.rb:30:in `require': cannot l
oad such file -- rubygems/defaults (LoadError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/rubygems.rb:30:in `<top
(required)>'
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
I have tried deleting ruby 2.0.0 from pik and the rails installer folder, because another SO thread said that would fix it. The commands were working as of 5 hours ago, and must have stopped right when I finished using the rails console (part of learning rails from this tutorial, it was just basic math and string manipulation, so I don't think I screwed something up). Any ideas on what I should do?
Try deleting 'ruby '1.9.3' ' from your gem file. It shouldn't be causing a problem, but I've seen situations where it has.
I don't know if I did something I don't know about, but to the best of my knowledge, adding the gem "bootstrap-sass" at version 2.3.2.0 got it working again. I doubt that it was adding that exact gem that was the solution, but you never know.
Versions:
Ruby 1.9.3p194
Rails 3.2.13
Bundler 1.3.5
When I run rails new new_app, I get:
run bundle install
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/ui.rb:36:in `initialize': undefined method `[]' for #<Thor::Shell::Color:0x00000002b25708> (NoMethodError)
from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:12:in `new'
from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:12:in `initialize'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:263:in `new'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/base.rb:386:in `start'
from /var/lib/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:20:in `block in <main>'
from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /var/lib/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:20:in `<main>'
The code in question in ui.rb is:
def initialize(options = {})
if options["no-color"] || !STDOUT.tty?
Thor::Base.shell = Thor::Shell::Basic
end
#shell = Thor::Base.shell.new
#level = ENV['DEBUG'] ? "debug" : "info"
end
I managed to fix it on my own. The post MrYoshiji linked above suggested that it was an incompatibility between Ruby and Rails. This was basically the problem - it was a version incompatibility, which is best resolved by using RVM to install a local (user-specific) copy of Ruby, Rails, etc.
But I had already installed RVM. There was a further issue that had to be resolved - RVM was not running as a function, which you can solve by setting your terminal to load /etc/profile on startup. How to do so in gnome-terminal is explained on the RVM site here.
However, this wasn't a good solution for me because it prevented my local bash files (such as ~/.bash_aliases) from loading. So instead of changing that terminal setting as shown on the RVM site, I opened ~/.bashrc and added the line source ~/.rvm/scripts/rvm. After restarting the terminal, everything was working fine - the right copies of Ruby and Rails were being used, and I was no longer encountering that error when I tried to create a new Rails app (presumably because I'm now using local copies of the gems as well, rather than a system-wide copy installed via APT).
I've been following Hartl's RoR tutorial and have hit an error in the sequence to set up Rails. I'm running OS X Lion 10.7.3.
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2#sec:rubygems
I've installed Git as instructed. I've installed RVM (1.10.3) in order to update Ruby to 1.9.3 (1.9.3p125 is the version displayed when I type "$ruby -v").
I have updated RubyGems to 1.8.17, the version fixed for the tutorial.
I used vi to create a gem configuration file, per the tutorial. I may have screwed this up somehow since I'm not familiar with vi, but this was the last thing that I did before hitting this error:
jboggan$ gem install rails -v 3.2.2
/Users/jboggan/.rvm/rubies/ruby-1.9.3 p125/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:183:in `merge': can't convert String into Hash (TypeError)
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:183:in `initialize'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/bin/gem:25:in `<main>'
I'd appreciate any input into getting past this. I've searched but been unable to find anyone else having this problem. This is my first post on SO, so please tell me if I need to provide more info, fix my phrasing, or do something to make the question more intelligible. Thanks so much!
I incorrectly edited my .gemrc file during the tutorial. I deleted the offending file and was able to install Rails 3.2.2 normally. See answer from No rails commands will run .