Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails "no such file to load -- rubygems (LoadError)"

I just switched from Heroku to Amazon Web Services. Previously I ran all of my Rails command line commands using my Command Prompt with Ruby (from my Windows PC). However, after I logged into my Amazon Linux EC2 instance, and then went into the directory of my app I receive this error:

/usr/bin/rails:9:in `require': no such file to load -- rubygems (LoadError)
    from /usr/bin/rails:9

when I try to run any commands like rails console.

I reviewed this question, but it doesn't seem like multiple Ruby libraries apply to me because

which -a ruby

only yields one location:

/usr/bin/ruby

Also, this question didn't seem to help as I haven't. When I tried typing in

rvm use 1.9.3

I receive this message:

-bash: rvm: command not found

It's my first time seeing a Linux environment, so any help would be appreciated. Thank you!

like image 274
yellowreign Avatar asked Nov 13 '22 11:11

yellowreign


1 Answers

I was running into he same issue with the identical error message. From my EC2 instance, I noticed my ruby version was 1.8 (ruby -v). I rebooted the EC2 instance, and this caused Elastic Beanstalk to spin up a new EC2 instance and terminate the old one. The new instance was running 1.9.3, and I became unblocked. I hate magical solutions, but with the old instance terminated, there was no more triage I could do. Hope this helps.

like image 63
Jeff Ort Avatar answered Nov 15 '22 07:11

Jeff Ort