Bob Cavezza's Blog

manifest_version key must be present and set to 2

 

If you are working through an older chrome extension tutorial, you will probably run through this error before any other error.  The reason you will likely get this error is that Chrome did not always force a version_manifest value in the manifest.json file.  Since moving from manifest_version 1 to manifest_version 2, I believe Google started to force the manifest to be declared because there were some changes from manifest_version of 1 to manifest_version of 2 that could break applications.

Two fix this issue, you need to add manifest_version: 2 into the code, and make sure it still results in a validated json format.

Example of Manifest.json that will cause this error

{
"name": "A Sample Chrome Extension",
"version": "1.0",
"description": "Description of your Chrome extension.",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},

“icons”:{
“128”:”icon_128.png”
}
}

 

Example Of Manifest.json that will fix this error


{
"name": "A Sample Chrome Extension",
"version": "1.0",
"manifest_version": 2,
"description": "Description of your Chrome extension.",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},

“icons”:{
“128”:”icon_128.png”
}
}

Fixing The Tutorialzine How to Build a Chrome Extension Series

Watch the Two Screencasts of debugging the entire tutorial

  1. You must set the manifest_version to 2
  2. icon.png needs to be downloaded
  3. Change popup variable name to default_popup - this is a very frustrating popup to find
  4. You need to download jquery.min.js and add it to the folder.  (I would download jquery-1.11.1.min.js and rename the script to jquery-1.11.1.min.js in tutorialzine.html
  5. You need to add a content_security_policy value to make external ajax calls and all external ajax calls must be made to https urls
  6. An extra broken image loads in the popup.  

 

§244 · September 29, 2014 · Chrome Extensions · · [Print]

Leave a Reply