Windows Gem 安装
我是 Ruby on Rails 的新手。我有一个关于安装 gem 的快速问题。
我使用的是带有 Ruby 1.9.2 和 Rails 3.0 的 Windows 7 64 位计算机,并且我正在尝试安装 gravatar_image_tag gem。
gem install gravatar_image_tag
我运行后它说它成功了。但是当我尝试这样做时:
gravatar_image_tag -v
它说 'gravatar_image_tag' 未被识别为内部或外部命令、可操作程序或批处理文件'
当我查看时在我的 ruby192/bin 文件中,有 Rails、注释等的批处理文件,可以正常工作,但没有 gravatar_image_tag 的批处理文件。
我想知道我哪里出了问题。
提前致谢。
I'm a newbie to Ruby on Rails. I had a quick question about installing gems.
I'm using a windows 7 64 bit machine with Ruby 1.9.2 and Rails 3.0 and I'm trying to install the gravatar_image_tag gem.
gem install gravatar_image_tag
After I run that it says its succcessful. But when I try to do this:
gravatar_image_tag -v
It says that 'gravatar_image_tag' is not recognized as an internal or external command, operable program or batch file'
When i looked into my ruby192/bin file there are batch files for rails, annotate etc etc that work fine but there's not batch file for gravatar_image_tag.
I was wondering where I'm going wrong with this.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
并非所有 gem 都可以从命令行执行。查看 gem 是否已安装(及其版本)的最佳方法是运行:
Not all gems are executable from the command line. The best way to see if a gem is installed (as well as its version) is to run:
如果您想在 Rails 3 项目中使用 gem,您应该将其添加到您的
Gemfile
(在项目的根目录中)。类似这样的事情然后运行
bundle install
。gravatar_image_tag
应放置在您视图中的某个位置,以生成正确的 html。更多信息请访问其 github 页面。
[编辑]也许我的回答不太重要。要检查 gem 是否已正确安装,您可以键入
或
是否使用捆绑器安装了 gem。
并非所有 gems 都会安装批处理文件,根据文档,这也不会。
If you want to use a gem inside your rails 3 project, you should add it to your
Gemfile
(in the root of your project). Something like thisthen run
bundle install
.The
gravatar_image_tag
should placed somewhere in your view, to generate the correct html.More information can be found on their github page.
[EDIT] Maybe my answer was not too the point. To check if the gem was correctly installed, you either type
or
if you installed the gem using bundler.
Not all gems install a batch-file, and according to the documentation this doesn't either.