The program 'gem' can be found in the foll

2019-04-10 20:58发布

I'm installing Ruby on Rails on Virtual Box/Ubuntu 13.10. Below are the steps

  1. ruby -v

    => The program 'ruby' can be found in the following packages ... Try: sudo apt-get install

  2. source /my account/...

    ==> Ok.

  3. \curl -L https://get.rvm.io | bash

    => I've got a message thanking me for using RVM. In case of problems, I should consult their website or twitter.

  4. rvm requirements

    ==> Requirments installation successful.

  5. type rvm | head -n 1

    ==> rvm is a function

  6. rvm list known

    ==> I get a list of ruby's versions

  7. rvm install 2.0.0 -C --enable-shared, --with-openssl-dir=/usr/local

    ==> Install of ruby 2.0.0 complete. Please consider upgrading to ruby 2.1.0 ...

  8. rvm list

    ==> rvm rubies =* ruby-2.0.0-p353 [i686 ]

    # => - current

    # =* - current && default

    # * - current

  9. rvm use 2.0.0@railstutorial_rails_4_0 --create --default

    ==> ok.

  10. rvm gemset list

    ==> gemsets for ruby-2.0.0-p353 ...

    (default)

    global

    => railstutorial_rails_4_0

  11. gem -v

    => The program 'gem' can be found in the following packages:

    • ruby1.9.1
    • rubygems try: sudo apt-get install

Why do I need to install ruby again? I thought I did so in step 7. I've gone over and over the same steps but I don't understand why it keeps telling me to install ruby again.

Thanks for helping

3条回答
爷的心禁止访问
2楼-- · 2019-04-10 21:03

It sounds like the rvm ruby is not actually being used. If you run ruby -v, what do you get? I suspect it will be the message from the system about ruby being available in a package. Are you sure your $PATH is set correctly?

If you run /bin/bash --login and try again what happens?

查看更多
萌系小妹纸
3楼-- · 2019-04-10 21:06

check what rvm list returns.

I had multiple ruby versions installed but had not selected the ruby version to use.

I did rvm use <ruby_version> --default then ruby as well as gem command worked.

查看更多
Explosion°爆炸
4楼-- · 2019-04-10 21:13

On your Terminal window go to Edit>Profile Preferences>Title and command, and check the box that says "Run command as a login shell". Restart your Terminal and try ruby -v and gem -v now. The versions should come up. If they don't then try re-installing them.

查看更多
登录 后发表回答