通过 git bash 找不到 gem 命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20086347/
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 08:41:19  来源:igfitidea点击:

gem command not found through git bash

rubygitbashgithubgit-bash

提问by intA

I'm new to git and I've been setting up a jekyll blog through my github account. I'm using the git bash command line. In the instructions one of the commands is:

我是 git 新手,我一直在通过我的 github 帐户建立一个 jekyll 博客。我正在使用 git bash 命令行。在说明中的命令之一是:

$ gem install jekyll

When I run this it tells me:

当我运行它时,它告诉我:

sh.exe": gem: command not found

Anyone know how I can fix this? Does this have anything to do with Ruby?

有谁知道我该如何解决这个问题?这和Ruby有关系吗?

回答by Thibaud Colas

gem, RubyGems, is a package manager for Ruby. It seems that it is not installed on your computer, or not available inside your $PATH.

gem, RubyGems,是 Ruby 的包管理器。它似乎没有安装在您的计算机上,或者在您的 $PATH 中不可用。

First, try to execute which gemto see whether you can access it or not. Then,

首先,尝试执行which gem,看看是否可以访问它。然后,

  • If you previously installed gem, you probably have to modify $PATHto add the package manager's executable location.

  • If you did not, you need to. On Windows, your best option is to install Cygwin.

  • 如果您之前安装了gem,您可能需要修改$PATH以添加包管理器的可执行位置。

  • 如果你没有,你需要。在 Windows 上,最好的选择是安装 Cygwin。