Ruby Gems返回“命令未找到" [英] Ruby Gems returns "command not found"
问题描述
Ubuntu 9.10
Ubuntu 9.10
刚刚安装了newgem
Just installed newgem
gem install newgem
当我尝试
newgem new_project
我知道
adam@adam-ubuntu:~$ newgem newproject
newgem: command not found
我已经通过echo $ PATH检查了我的路径
Ive checked my path via echo $PATH
adam@adam-ubuntu:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/adam/.gem
和我的宝石环境
adam@adam-ubuntu:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/adam/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
我对路径等并不热,但是上面列出的所有gem目录都在路径上,所以怎么找不到命令?
Im not hot with paths etc but all the gem directories listed above are on the path so how come it cant find the command?
推荐答案
您的$PATH
变量需要包含指向Ruby的bin目录的确切路径.在PATH
中添加目录不包括其子文件夹.尝试通过以下方式添加bin目录:
Your $PATH
variable needs to include the exact path to your Ruby's bin directory. Adding a directory to the PATH
does not include it's subfolders. Try adding the bin directory via:
export PATH=$PATH:/home/adam/.gem/ruby/1.8/bin
,或者如果您使用sudo
安装了gem:
or if you installed the gem using sudo
:
export PATH=$PATH:/usr/lib/ruby/gems/1.8/bin
您可能希望将其添加到您的.bashrc
文件中,这样就不必在每次打开新bash时都手动进行设置.
You might want to add this to your .bashrc
file, so that you don't have to set this manually every time your open up a new bash.
这篇关于Ruby Gems返回“命令未找到"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!