Ruby Gems 返回“找不到命令"; [英] Ruby Gems returns "command not found"

查看:18
本文介绍了Ruby Gems 返回“找不到命令";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆