Chrome error: Package is invalid: 'CRX_VERSION

2020-08-01 01:37发布

Can somebody help with this error? It comes up when I'm trying to install (drag and drop .crx file) custom chrome extension. The extension is working fine on another computers.

{ "manifest_version": 2,

  "name": "Foo",
  "description": "Bar",
  "version": "2.0",

  "browser_action": {
    "default_title": "Foo",
    "default_icon": "icon.png",
    "default_popup": "popup1.html"
  },

  "background": {
    "scripts": [ "back.js" ]
  },

  "permissions": ["<all_urls>", "tabs", "activeTab", "storage"],

  "content_scripts": [
    {
      "matches": ["*://foo.bar.ms/*"],
      "js": ["websites/facebook/authorization.js"],
      "run_at": "document_start"
    },
    {
      "matches": ["*://*.facebook.com/*"],
      "js": ["jquery-3.2.1.min.js", "utils.js", "websites/facebook/to_friends.js"],
      "run_at": "document_idle",
      "exclude_matches":["*://*.facebook.com/","*://*.facebook.com/?stype*","*://*.facebook.com/login.php*","*://*.facebook.com/pg/*"]
    },
    {
      "matches": ["https://foo.bar/"],
      "js": ["jquery-3.2.1.min.js", "utils.js", "websites/facebook/waiting.js"],
      "run_at": "document_end"
    },
    {
      "matches": ["*://*.facebook.com/pg/*"],
      "js": ["jquery-3.2.1.min.js", "utils.js", "websites/facebook/to_group_posts.js"],
      "run_at": "document_idle"
    }
  ]
}

1条回答
狗以群分
2楼-- · 2020-08-01 02:14

I've blogged about this here https://medium.com/engineering-on-the-incline/distributing-chrome-extensions-for-older-versions-of-chrome-crx-version-number-invalid-be14325329e5

This is caused due to the CRX format of the browser used to package the extension for distribution being different from the CRX format being used by your browser.

I had this issue when packaging an extension in Chrome 67 for a client using Chrome 57.

The solution to the problem is to find out what version of Chrome the target user is using and package your extension with that version. Having looked at the source code it looks like Chrome 67 is supporting CRX2 and CRX3 formats. I imagine earlier versions of chrome were using CRX1.

When an extension is distributed by the Chrome store you do not experience this problem as they are able to send you a signed package using the CRX version as required by your browser version.

查看更多
登录 后发表回答