问题描述
OSX,10.9.2:
OSX, 10.9.2:
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ knife -v
Chef: 11.10.4
运行时:
$ knife ec2 server list
我得到:
FATAL: Cannot find sub command for: 'ec2 server list'
The ec2 commands were moved to plugins in Chef 0.10
You can install the plugin with `(sudo) gem install knife-ec2
我已安装了gem:
sudo gem install knife-ec2
运行没有错误。并且gem list显示它已安装:
runs without error. And gem list shows that it is installed:
$ sudo gem list|grep knife-ec2
knife-ec2 (0.8.0)
该宝石似乎已正确安装在这里:
The gem appears to be correctly installed here:
ls /Library/Ruby/Gems/2.0.0/gems/knife-ec2-0.8.0/
...
/ usr / bin / knife本身运行良好。它很可能与刀在哪里寻找插件有关,但是目前尚不清楚该怎么做。
/usr/bin/knife on its own runs fine. Its quite likely it has something to do with where knife is looking for plugins, but what to do about it is unclear.
推荐答案
在我已经安装了Chef / Knife / knife-ec2之后,在安装chefdk时遇到了这个问题或类似问题通过宝石安装(试图使vagrant-berkshelf运行,如果您想知道的话)。
I had this or a similar problem when I installed the chefdk after I'd already had chef/knife/knife-ec2 installed via gems (in an attempt to get vagrant-berkshelf working, if you're wondering).
我发现,在安装chefdk时,嵌入式厨师红宝石是在路径中由刀二进制文件使用,而不是系统红宝石,因此必须将宝石安装到厨师嵌入的红宝石中。
What I found is that when installing the chefdk the embedded chef ruby is used by the knife binary in your path, instead of the system ruby, so you have to install your gems to the chef embedded ruby.
在OSX上,我是这样做的:
On OSX I did it like this:
/opt/chefdk/embedded/bin/gem install knife-ec2
编辑:看起来已经有厨师命令这样做了:
Looks like there's a chef command to do this already:
chef gem install knife-ec2
这篇关于如何安装knife-ec2插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!