rails new and gem install no longer work after new Ruby version

427 views Asked by At

I have been studying Ruby on Rails for over a month now. I have been learning on Ruby-2.3.4/Rails-4.2.5, I installed Ruby-2.5.0/Rails-5.1.4 and I am trying to create and configure a very simple new app, but seemingly random issues come up that I haven't had up until this point.

I am using codeanywhere.com as my development environment, and my Container is running Ubuntu 14.04.5

I installed ruby-2.5.0, and I also installed Rails 5.1.4. I then did rvm use ruby-2.5.0. I think part of the problem is that I installed Rails 5.1.4 without first doing rvm use ruby-2.5.0. Since then, I cannot do rails _5.1.4_ new appname, or gem install rails -v 5.1.4 as if the rubygems and rails are not installed. rails new gives error "bash: rails: command not found", and gem install gives error "/home/travis/.rvm/rubies/ruby-2.5.0/bin/ruby: bad interpreter: No such file or directory"

which ruby:
/home/cabox/.rvm/rubies/ruby-2.5.0/bin/ruby
which rails:
(no output)

ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
rails -v
bash: rails: command not found

gem list
-bash: /home/cabox/.rvm/rubies/ruby-2.5.0/bin/gem: /home/travis/.rvm/rubies/ruby-2.5.0/bin/ruby: bad interpreter: No such file or directory

$PATH - /home/cabox/.rvm/gems/ruby-2.5.0/bin:/home/cabox/.rvm/gems/ruby-2.5.0@global/bin:/home/cabox/.rvm/rubies/ruby-2.5.0/bin:/home/cabox/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

I am trying to figure out, what are the things I need to do after installing a new Ruby/Rails version using RVM and gem install? At this point, I can't tell which errors i'm getting because something is weirdly wrong that I don't know about, vs making actual syntax error (like class names being wrong case, etc). Are there simple "do this every time" or "do this to pair Ruby and Rails versions properly" considerations I need to be aware of? I've seen reference to some file that you need to add the new version of Ruby to to get program calls to work right again, but the location of that seems to be assumed (maybe $PATH?).

Any advice will be carefully heeded, so please help! I would like to be able to work with multiple versions at will.

Thanks!

Edit: It looks like i'm not the only one with this issue. The suggested fix of doing the install/reinstall (i tried a fresh dev environment as well) with --disable-binary did not solve my issues though:

rvm reinstall 2.5 --disable-binary

The latest I am able to use without issue is Ruby-2.4.1/Rails-5.1.4. It's fine for me to stick with these for now if I must, as I am still learning. Just thought maybe I was doing something silly that could be easily fixed, and didn't want to miss a learning opportunity.

0

There are 0 answers