尽管安装了宝石,仍然无法找到宝石 [英] gem which cannot find gem despite it being installed
问题描述
我已经构建了我的第一个gem,但我似乎无法正确安装它。我可以发出命令:
pre $ sudo gem install ceilingfish -toto
$ b $ p
产生输出
成功安装了ceilingfish-toto-0.3。 6
1 gem installed
但是当我输入 gem which ceilingfish-TOTO
。我得到输出
无法找到ruby库文件或共享库ceilingfish-toto
这非常奇怪,因为如果我去看看我的gems文件夹,我可以看到所有安装的文件
#ls -l /opt/local/lib/ruby/gems/1.8/gems/ceilingfish-toto-0.3.6/
共计48
-rw-r - r-- 1 root admin 1053 14 Feb 17:16许可证
-rw -r - r-- 1 root admin 6166 14 Feb 17:16 README.md
-rw-r - r-- 1 root admin 879 14 Feb 17:16 Rakefile
-rw -r - r-- 1 root admin 6 14 Feb 17:16 VERSION
-rw- r - r - 1 root admin 2477 14 Feb 17:16 ceilingfish-toto.gemspec
drwxr-xr-x 7 root admin 238 2月17日17:16 test
有谁知道可能导致这种情况的原因?我认为这是抱怨,因为宝石名称中有一个连字符。你可以在这里看到gemspec http://github.com/ceilingfish/toto
gem哪些ceilingfish-toto
通过gem require路径查找名为ceilingfish-toto的文件.RB。由于没有一个,它什么都没有返回。你的工作是 gem which toto
,但是因为 lib /
不包含在你的gem spec中,所以lib文件未安装,因此它不存在。
重新运行 rake gemspec
可能会解决此问题。 p>
另外,您可以使用 gem list ceilingfish-toto
来检查是否安装了gem,告诉你它已经安装,不管它有什么文件(它也会列出安装的版本)。
I've built my first gem but I don't seem to be able to get it to install correctly. I can issue the command
sudo gem install ceilingfish-toto
Which produces the output
Successfully installed ceilingfish-toto-0.3.6
1 gem installed
But when I then type gem which ceilingfish-toto
. I get the output
Can't find ruby library file or shared library ceilingfish-toto
Which is very strange because if I go and look in my gems folder I can see all the files installed there
# ls -l /opt/local/lib/ruby/gems/1.8/gems/ceilingfish-toto-0.3.6/
total 48
-rw-r--r-- 1 root admin 1053 14 Feb 17:16 LICENSE
-rw-r--r-- 1 root admin 6166 14 Feb 17:16 README.md
-rw-r--r-- 1 root admin 879 14 Feb 17:16 Rakefile
-rw-r--r-- 1 root admin 6 14 Feb 17:16 VERSION
-rw-r--r-- 1 root admin 2477 14 Feb 17:16 ceilingfish-toto.gemspec
drwxr-xr-x 7 root admin 238 14 Feb 17:16 test
Does anyone know what could cause this? I think it's complaining because there is a hyphen in the gem name. You can see the gemspec here http://github.com/ceilingfish/toto
gem which ceilingfish-toto
looks through the gem require path for a file named ceilingfish-toto.rb. Since there isn't one, it returns nothing. What would work for you is gem which toto
, but since lib/
is not included in your gem spec, the lib files are not installed, so it doesn't exist.
Rerunning rake gemspec
might fix the problem.
As an aside, you can check whether a gem is installed by its name by using gem list ceilingfish-toto
which should show you it is installed, regardless of the files it has(it will also list the versions installed).
这篇关于尽管安装了宝石,仍然无法找到宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!