Search code examples
google-chrome-extensionchrome-web-store

Submitted Chrome extension: "manifest is invalid" on download


I recently submitted a chrome extension, but when I try to download the extension it says that the manifest file is invalid. Not sure why.

Here is my manifest :

{
    "name": "My chrome extension",
    "version": "0.2",
    "description": "My chrome extension description.",
    "permissions": [ "activeTab", "tabs", "contextMenus" ],
    "background": {
        "persistent": false
    },
    "browser_action": {
        "default_icon": "favicon.png",
        "default_popup": "index.html"
},
 "manifest_version": 2
}

Is there a tool online where I can validate a Chrome extension manifest file?


Solution

  • You are missing scripts in your background item.

    {
        ...
        "permissions": [ "activeTab", "tabs", "contextMenus" ],
        "background": {
            "scripts": [
               "path/to/js/script",
             ], 
            "persistent": false
        },
        "browser_action": {
            "default_icon": "favicon.png",
            "default_popup": "index.html"
        },
        ...
    }
    

    OR just remove the background item from your manifest if you are not planning on using it.

    {
            ...
            "permissions": [ "activeTab", "tabs", "contextMenus" ],
            "browser_action": {
                "default_icon": "favicon.png",
                "default_popup": "index.html"
            },
            ...
        }
    

    --

    You don't need tools to test the manifest, go to the chrome://extensions page, enable developer mode on the top right and load your extension, it will tell you the error and how to solve it.