Git Bash 给出 sh.exe: ruby​​: command not found

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23713582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 10:28:38  来源:igfitidea点击:

Git Bash giving sh.exe: ruby: command not found

rubygitbash

提问by Alice Chiu

I am using Git Bash on Windows Vista Business. I am trying to install Redmine. Basically on step 4, I need to get RubyGem installed before I install the bundler as part of the dependency install (http://www.redmine.org/projects/redmine/wiki/RedmineInstall). I downloaded rubygems-2.2.2.zip from https://rubygems.org/pages/download. Then I unzipped the file a folder on my desktop.

我在 Windows Vista Business 上使用 Git Bash。我正在尝试安装 Redmine。基本上在第 4 步,我需要在安装捆绑程序之前安装 RubyGem 作为依赖项安装的一部分(http://www.redmine.org/projects/redmine/wiki/RedmineInstall)。我从https://rubygems.org/pages/download下载了 ruby​​gems-2.2.2.zip 。然后我将文件解压缩到桌面上的文件夹中。

In Git Bash, I typed ruby setup.rb, I get sh.exe: ruby: command not found. Is it something related to the PATHenvironment? If so, how do I include it so that Git Bash will see the setup file and run it?

在 Git Bash 中,我输入ruby setup.rb,我得到sh.exe: ruby: command not found. 是不是跟PATH环境有关?如果是这样,我如何包含它以便 Git Bash 看到安装文件并运行它?

Ruby 1.9.3- p545 is already installed.

Ruby 1.9.3- p545 已安装。

Thanks in advance.

提前致谢。

回答by Maxo

If you already installed ruby, you have to include correct path.

如果您已经安装了 ruby​​,则必须包含正确的路径。

Right click My Computer, click Properties, go to Advanced System Settingsleft navigation, click on Environment Variables...button, go to System Variablesbelow, select Path, click Editand in the beginning of the path enter: C:\Ruby200\bin;(Please note that in here you should indicate the ruby executable path. In case you installed ruby using Ruby installer for windows then the above mentioned path is correct).

右键单击My Computer,单击Properties,转到Advanced System Settings左侧导航,单击Environment Variables...按钮,转到System Variables下方,选择Path,单击Edit并在路径的开头输入:(C:\Ruby200\bin;请注意,此处应指明 ruby​​ 可执行路径。如果您安装了 ruby​​ 使用Windows 的 Ruby 安装程序,那么上述路径是正确的)。