【发布时间】:2019-04-30 20:22:13
【问题描述】:
我正在尝试将我的扩展程序发布到 Chrome 网上应用店。在开发人员模式下作为解压扩展加载时一切正常。但是,当我在上传我的 zip 文件后预览更改并尝试打开弹出窗口时,弹出的 html 页面似乎缺失,并显示以下错误消息:
找不到您的文件 它可能已被移动或删除。 ERR_FILE_NOT_FOUND
弹出的控制台没有抛出错误。
我的 manifest.json 如下:
{
"name": "<name>",
"version": "0.13",
"description": "<description>",
"permissions": ["*://*/*", "identity", "activeTab", "tabs", "storage"],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"background": {
"scripts": ["dist/background/index.js"],
"persistent": true
},
"content_scripts": [],
"web_accessible_resources": ["dist/content_scripts/index.css"],
"browser_action": {
"default_popup": "dist/popup/popup.html",
"default_icon": {
"16": "images/icon_16.png",
"32": "images/icon_32.png",
"48": "images/icon_48.png",
"128": "images/icon_128.png"
}
},
"icons": {
"16": "images/icon_16.png",
"32": "images/icon_32.png",
"48": "images/icon_48.png",
"128": "images/icon_128.png"
},
"oauth2": {
"client_id": "<client_id>",
"scopes": [
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
]
},
"key": "<my_key>",
"manifest_version": 2
}
相对于压缩前的清单,所有文件都位于正确的位置。
这是 popup.html 文件的内容(popup.js 在#root 上挂载了一个 React 应用程序):
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,500,600" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.1.1/themes/reset-min.css" integrity="sha256-JQ2nnTmybhOWSjfV3sa8mG0ZVhTCcORER4cyXc5HL10=" crossorigin="anonymous">
<link rel="stylesheet" href="popup.css">
</head>
<body>
<div id="root"></div>
<script src="popup.js"></script>
</body>
</html>
我查看了 Chrome 文档,但它们在这方面要么稀疏要么过时。有人可以帮忙吗?
谢谢
(编辑:我之前也上传了 zip,但忘记将 popup.html 移动到 dist/popup 文件夹,因此该文件实际上丢失了,以防万一)
【问题讨论】:
-
肯定有问题。在您的扩展程序或 Chrome 中。检查浏览器配置文件目录中已安装的扩展并确保所有路径都正确。如果不亲自尝试扩展,我看不到任何其他解释。
标签: javascript google-chrome google-chrome-extension