繁体   English   中英

Chrome扩展程序中弹出错误file_not_found

[英]Error file_not_found for popup in Chrome extension

我正在尝试将我的扩展程序发布到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文件夹,以便文件实际上丢失了,以防相关)

似乎我在上传这个新版本和之前的版本之间犯了一个错误。 ~/.config/google-chrome/Default/Extensions/<extension_id> (在Linux上)查看Chrome配置文件时,我意识到最后发布的版本是0.11,其中popup.html文件丢失,我原以为在(0.12)之间发布了更新的版本以解决这个问题,但我发现事实并非如此。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM