Reputation: 29
I installed rails, but when I try to run $rails console I get an error. Can anybody tell me what should I do?(I know similar questions have been asked before, but I still don't know what exactly should I do.) If that helps, I have ubuntu 13.10, ruby 2.1.2, rails 4.1.1. The error is pretty long, this is how it starts:
Loading development environment (Rails 4.1.1)
load error: /home/u12/.rvm/rubies/ruby-2.1.2/.irbrc
NoMethodError: undefined method `split' for nil:NilClass
/home/u12/.rvm/scripts/irbrc.rb:45:in `<top (required)>'
/home/u12/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
Upvotes: 0
Views: 545
Reputation: 4633
First try:
rvm get stable
If it doesn't work:
As stated in this previous thread:
Load error when running rails console
The problem might be that the ENV['GEM_HOME'] is nil.
Spring seems to be the problem and a small incompatibility with rvm.
Just change the env variable to a blank string.
If you encounter this problem you should restart you computer. If that does not fix it read on.
The bin/spring file sets ENV["GEM_HOME"] to a non blank string
bin/spring
11 ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12 ENV["GEM_HOME"] = "spring"
13 Gem.paths = ENV
Upvotes: 1
Reputation: 2474
It seems one of your files tries to call the split method on a variable that is nil instead of a string. You should either check that it's actually a string before calling split, or use the to_s method to make sure it never raise an exeception.
Upvotes: 0