安装加载项时出错

编程入门 行业动态 更新时间:2024-10-17 09:42:02
本文介绍了安装加载项时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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 ..

更多推荐

安装加载项时出错

本文发布于:2023-11-24 02:13:41,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!