![](/img/trans.png)
[英]Getting “ERR_FILE_NOT_FOUND” in my Chrome extension's popup
[英]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.