执行 gem 时,未知命令 [英] While executing gem, unknown command

查看:41
本文介绍了执行 gem 时,未知命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我输入gem命令时,比如

Whenever I enter a gem command, such as

gem "tilt"

gem "mysql"

我收到此错误:

While executing gem ... <RuntimeError>
Unknown command tilt

当我运行 gem list 时,tilt 和 mysql 都显示在列表中,因此它们已安装.事实上,我对列表中的每个项目都收到了这个错误.这可能是什么原因造成的?

When I run gem list, both tilt and mysql show up on the list, so they are installed. In fact, I get this error with every item on the list. What could be causing this?

推荐答案

gem 没有骗你,它们不是有效的 gem 命令.

gem isn't lying to you, they aren't valid gem commands.

也许您将命令行与 Bundler 混淆了?例如,添加

Perhaps you're confusing the command line with Bundler? For example, adding

gem "tilt"

到 Gemfile 并运行 bundle install 将安装倾斜.但是 Bundler 使用自己的语法,而不是 shell 脚本.要直接使用 gem 二进制文件安装倾斜,您必须这样做:

to a Gemfile and running bundle install will install tilt. But Bundler uses its own syntax, and isn't a shell script. To install tilt using the gem binary directly you'd have to do:

gem install tilt

运行 gem help 将为您提供 gem 的命令行参数列表.

Running gem help will give you a list of gem's command line arguments.

这篇关于执行 gem 时,未知命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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