The program 'gem' can be found in the following packages

妖精的绣舞 提交于 2019-12-21 20:39:00

问题


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


回答1:


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.




回答2:


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:


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.



来源:https://stackoverflow.com/questions/21650849/the-program-gem-can-be-found-in-the-following-packages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!