安装加载项时出错 [英] Error when installing add-on

查看:160
本文介绍了安装加载项时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  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

zip -r myexample.xpi myexample /

$ c>工具 - >附加组件 - >从文件安装附件... - >选择myexample.xpi 写道:

这个加载项无法安装,因为它似乎已损坏。



我有什么问题?

解决方案

<你的问题的标题是误导 - 你的 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 find install.rdf file at the top level of your add-on. If you run unzip -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屋!

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