2

I'm trying to start a new rails app and for some reason my computer is no longer recognising rails....it's been working fine on every other rails app I've been working on until now.

When I typed;

rails new test_app -d postgresql -T

It threw up this error:

/home/camillavk/.rvm/gems/ruby-2.1.5/bin/rails:23:in `load': cannot load such file -- /home/camillavk/.rvm/gems/ruby-2.1.5/gems/rails-4.2.0/bin/rails (LoadError)
        from /home/camillavk/.rvm/gems/ruby-2.1.5/bin/rails:23:in `<main>'
        from /home/camillavk/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
        from /home/camillavk/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'

The same error is being thrown when I type rails -v. But when I type which rails I get

/home/camillavk/.rvm/gems/ruby-2.1.5/bin/rails

I then tried to run gem install rails and all it says is 1 gem installed

Any ideas on why rails is doing this on my computer and how to fix it?

*EDIT

gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/camillavk/.rvm/gems/ruby-2.1.5
  - RUBY EXECUTABLE: /home/camillavk/.rvm/rubies/ruby-2.1.5/bin/ruby
  - EXECUTABLE DIRECTORY: /home/camillavk/.rvm/gems/ruby-2.1.5/bin
  - SPEC CACHE DIRECTORY: /home/camillavk/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/camillavk/.rvm/rubies/ruby-2.1.5/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/camillavk/.rvm/gems/ruby-2.1.5
     - /home/camillavk/.rvm/gems/ruby-2.1.5@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-rdoc --no-ri"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/camillavk/.rvm/gems/ruby-2.1.5/bin
     - /home/camillavk/.rvm/gems/ruby-2.1.5@global/bin
     - /home/camillavk/.rvm/rubies/ruby-2.1.5/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /home/camillavk/bin
     - /usr/local/java/jdk1.8.0_25/bin
     - /home/camillavk/.rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /home/camillavk/.rvm/bin
camillavk
  • 501
  • 4
  • 17

3 Answers3

1

In case anyone else runs into this issue, I figured that rvm was just getting confused so I told it to use an older version of ruby

$ rvm use 1.9.3

THEN I ran rails new again. This time it worked so I changed into the new app, opened up the gemfile and in there told it to use the newer version of ruby again.

camillavk
  • 501
  • 4
  • 17
0

@camillavk,

Please see if the following rvm website link helps (make sure the info. included in these files mentioned in the article is accurate when you check them).

When I first started to use rvm, I used to have such issues as well so I am very careful to define all the rvm setup files for my rails projects.

RVM Projects

Ali Khan
  • 59
  • 8
  • but the link is talking only about project files...the problem is I cannot start a new Rails project at all... – camillavk Feb 13 '15 at 15:41
-2

I just figured out a exactly the same problem and just used the following command:

gem uninstall -a   

Which deletes all unnecessary gems. After that my environment worked well.

Benj
  • 12,503
  • 1
  • 34
  • 69
miwang
  • 1