sudo gem install rails- this doesn't give me a rails command for bash

試著忘記壹切 提交于 2019-12-10 21:09:58

问题


I'm on Ubuntu. I type in sudo gem install rails. This works fine, installs railes and 7 other gems fine. Yet $ rails blog is saying this:

The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

回答1:


how did you install rubygems, as an admin, or as a user? if you installed it as a user, it may not have the bin directory in your path.

If I were you, (assuming you installed rubygems into your home folder), I would trash that installation dir (not sure where it defaults to, maybe ~/rubygems? or ~/.rubygems?), then run setup.rb from the rubygems tarball as admin (through sudo) I've done this at least a dozen times on ubuntu, and haven't run into the issue you are hitting.

If that isn't the case, could you please link to the blog post you were following?




回答2:


Type

gem env

It will give you the installable directory where the bins of the gems are being installed. Something like this:

EXECUTABLE DIRECTORY: /usr/bin

Make sure this directory is in your path.




回答3:


Make sure your gem executable path is added to your system path so that the system can find the rails executable.




回答4:


I know this is an old thread but the same error had me stuck. Make sure you add

source ~/.rvm/scripts/rvm to your .bashrc file



来源:https://stackoverflow.com/questions/3065839/sudo-gem-install-rails-this-doesnt-give-me-a-rails-command-for-bash

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