安装加载项时出错 [英] Error when installing add-on
问题描述
myexample
- 安装我的示例扩展,它具有以下目录结构.rdf
- chrome.manifest
- content
- myexample.js
- myexample.xul
文件chrome.manifest包含:
$ b
内容myexample chrome / content / p>
overlay chrome://browser/content/browser.xul
chrome://myexample/content/myexample.xul
blockquote>
这是非常简约的扩展。
我创建了一个zip文件:
$ b$ c>工具 - >附加组件 - >从文件安装附件... - >选择myexample.xpi 写道:
zip -r myexample.xpi myexample /
这个加载项无法安装,因为它似乎已损坏。
我有什么问题?
解决方案<你的问题的标题是误导 - 你的
chrome.manifest
没有任何问题。这个错误消息意味着Firefox无法在您的加载项的顶层找到install.rdf
文件。如果你运行unzip -l myexample.xpi
,你会看到如下所示:
长度日期时间名称
-------- ---- ---- ----
myexample /
myexample / install.rdf
myexample / chrome.manifest
myexample / content /
正如你所看到的,你压缩的所有文件已被放入
myexample /
子目录中,而不是位于档案的顶层。为了得到正确的结果,你需要运行以下命令:
cd myexample
zip -r ../myexample .xpi *
cd ..
I'm trying to install my example extension which has the following directory structure.
myexample - install.rdf - chrome.manifest - content -- myexample.js -- myexample.xul
The file chrome.manifest contains:
content myexample chrome/content/
overlay chrome://browser/content/browser.xul chrome://myexample/content/myexample.xul
It's pretty minimalist extension.
I created a zip file from it:
zip -r myexample.xpi myexample/
When installing it in Firefox
Tools -> Add-ons -> Install Add-on from file ... -> choose myexample.xpi
it writes:
This add-on could not be installed because it appears to be corrupt.
Did I something wrong?
解决方案The title of your question is misleading - there is nothing wrong with your
chrome.manifest
. This error message rather means that Firefox couldn't findinstall.rdf
file at the top level of your add-on. If you rununzip -l myexample.xpi
you will see something like this:Length Date Time Name -------- ---- ---- ---- myexample/ myexample/install.rdf myexample/chrome.manifest myexample/content/
As you see, all files you zipped have been put into the
myexample/
subdirectory instead of being at the top level of the archive. To get the correct result you need to run the following commands:cd myexample zip -r ../myexample.xpi * cd ..
这篇关于安装加载项时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!