You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chrome扩展加载报错:'icons'值无效问题求助

Chrome扩展Manifest加载错误:"Invalid value for 'icons'"排查方案

核心问题:路径格式错误

你的manifest中图标路径开头使用了斜杠(/),这会被Chrome解析为系统根路径,导致无法定位到扩展目录下的图标文件。Chrome扩展引用本地资源需使用相对路径(以manifest.json所在目录为起点),不能加开头的斜杠。

修正步骤:

  1. 调整icons字段的路径:删除每个src值开头的/,比如将"/icons/Google-Chrome-Google-Chrome.16.png"改为"icons/Google-Chrome-Google-Chrome.16.png"
  2. 修正action.default_icon的路径:同样去掉开头的/,改为"icons/Google-Chrome-Google-Chrome.16.png"

修正后的完整manifest代码:

{
    "manifest_version": 3,
    "name": "Assessment tool",
    "version": "1.0",
    "description": "Scrapes information from website and performs a set of calculations",
    "icons": [
      {
        "src": "icons/Google-Chrome-Google-Chrome.16.png",
        "sizes": "16x16",
        "type": "image/png"
      },
      {
        "src": "icons/Google-Chrome-Google-Chrome.48.png",
        "sizes": "48x48",
        "type": "image/png"
      },
      {
        "src": "icons/Google-Chrome-Google-Chrome.128.png",
        "sizes": "128x128",
        "type": "image/png"
      }
    ],
    "action": {
      "default_icon": "icons/Google-Chrome-Google-Chrome.16.png",
      "default_title": "Assessment tool",
      "default_popup": "popup.html"
    },
    "host_permissions": [
      "https://www.assessment.co.uk/*"
    ],
    "web_accessible_resources": [
      {
        "resources": [
          "/popup.css",
          "/popup.html",
          "/script.js"
        ],
        "matches": [
          "https://*/*",
          "http://*/*"
        ]
      }
    ]
  }

额外验证项:

  • 确认icons文件夹与manifest.json处于同一目录,图标文件名和代码中完全一致(Linux/macOS环境需注意大小写区分)
  • 检查图标文件是否为有效PNG格式,没有损坏

内容的提问来源于stack exchange,提问作者gator123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 14:02:32