5

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!

Community
  • 1
  • 1
yellowreign
  • 3,528
  • 8
  • 43
  • 80
  • how you installed ruby?? using rvm?? – vijikumar Feb 15 '13 at 08:31
  • No, Amazon Elastic Beanstalk automatically installs it on the Linux server. – yellowreign Feb 15 '13 at 18:27
  • @yellowreign Did you find an answer to your question? [Mine is similar](http://stackoverflow.com/questions/17582580/ruby-no-such-file-to-load-ubygems-loaderror-when-running-cap-rubbercreate) - maybe you can help?! – JJD Jul 11 '13 at 09:07

3 Answers3

1

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.

Jeff Ort
  • 26
  • 3
0
-bash: rvm: command not found

This clearly says that rvm is not installed on your machine or if installed you haven't set the path properly.

Check path

Sometimes there is gem versioning pointing to the wrong one.

This happened with me sometime back----

Disregard! sudo bundle install was bundling 2.3.8 instead of 3.0.0.beta3. Fixed it by specifying the version in my Gemfile.

To make sure the compilation goes smoothly, scroll back in your terminal session and look at the list of prerequisite packages that should be installed (it’s probably best to cut and paste the whole lot of names to save yourself from typing errors).

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion

Now you can use use rvm to download, compile, and install Ruby.

1 rvm install 1.9.3

2 rvm use 1.9.3 --default

Guess it's more of a problem related to RVM and some weird linkage to osx's system ruby? (I installed RVM on a user level)

sjain
  • 23,126
  • 28
  • 107
  • 185
0

I have used gem install bundler. Then run rvm install works fine

Sandip Mondal
  • 921
  • 7
  • 12