我收到错误:borderify.zip 不包含有效的清单
该扩展直接来自 Mozilla 的 github,我是从这里直接访问的:https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension
然后我编辑了清单,因为我读到可能需要 ID,因为附加组件未签名。结果清单在这里:
{
"description": "Adds a solid red border to all webpages matching mozilla.org. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#borderify",
"manifest_version": 2,
"name": "Borderify",
"version": "1.0",
"homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/borderify",
"icons": {
"48": "icons/border-48.png"
},
"content_scripts": [
{
"matches": ["*://*.mozilla.org/*"],
"js": ["borderify.js"]
}
],
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "42.0"
}
}
}
我打开浏览器控制台看到以下跟踪:
While creating services from category 'app-startup', service for entry 'ExtensionsChild', contract ID '@mozilla.org/extensions/child;1' does not implement nsIObserver.
1680035666208 addons.xpi WARN Checking C:\Program Files\Mozilla Firefox\distribution\extensions for addons
[ACTION FAILED] TEMPORARY_EXTENSION_INSTALL_FAILURE: File D:\nicho\Documents\sandbox\browser extension\borderify.zip does not contain a valid manifest error-logging.js:16:17
errorLoggingMiddleware resource://devtools/client/aboutdebugging/src/middleware/error-logging.js:16
debugTargetListenerMiddleware resource://devtools/client/aboutdebugging/src/middleware/debug-target-listener.js:107
Redux 2
installTemporaryExtension resource://devtools/client/aboutdebugging/src/actions/debug-targets.js:142
loadManifest@resource://gre/modules/addons/XPIInstall.jsm:684:11
error-logging.js:27:17
errorLoggingMiddleware resource://devtools/client/aboutdebugging/src/middleware/error-logging.js:27
debugTargetListenerMiddleware resource://devtools/client/aboutdebugging/src/middleware/debug-target-listener.js:107
Redux 2
installTemporaryExtension resource://devtools/client/aboutdebugging/src/actions/debug-targets.js:142`
我一定错过了一些非常简单的东西。我运行的是 Windows 10 和 Firefox 111.0.1(64 位)。
虽然这可能很尴尬,但我不得不承认我试图通过选择 zip 文件来加载插件。
相反,我所要做的就是选择扩展程序文件夹中的任何文件。 (不是档案)。我将其发布在这里,以防其他人犯同样的错误。抱歉,祝你好运。
出于同样的原因,我遇到了同样的问题。就我而言,chatgpt 告诉我这就是加载插件的方式。它告诉我将目录打包为 zip,然后选择 zip 文件。我花了一些时间试图让它修复清单文件,而它的代码已经很好了,哈哈。