6

NOTE: this question is about the version attribute of the manifest.json that you use when you do Chrome developpment. It looks similar with the question below about manifest_version but it's not. I really tried to learn from that but I failed.

Need to update Chrome extension to manifest version 2 if no manifest version originally specified?

--

I am currently doing my first Chrome extension. Powerful, fun, great.

Except a stupid thing that keeps annoying me.

My Chrome extension is open-source, so you can go straight to the code on GitHub so you can see in an instant that I made a stupid mistake

https://github.com/internaciulo/search-tab-in-chrome-s-omnibox

In manifest.json, the most imortant file in Chrome development, you should see

{
  ...
  "version": "13",
  ...
}

The chrome extension itself works well enough, see the screenshots folder on github, ... but only locally, that is when I open it as an unpackage app (this can be done in Chrome by going into chrome://extensions

Great, so I head up to [Chrome's Webstore Developer Dashbord], upload, let 2 or 3 users download it for free, Profit !


Not quite.

I tried everything : maybe he wants 13or "13" or "13.0" or there is a confusion with manifest_version which must be an integer or or or or. Every time the same annoying error :

Upload an extension or app (.zip file)
search-tab-in-chrome-s-omnibox.zip (Server rejected)
An error occurred: Failed to process your item.

The manifest must define a version.

Oh Computers, you are so useful, but why are so intolerants to our mistakes dear computer ? Yes, they are stupid, but since the beginning of Computing, you should have learned that we are "Humans, All Too Humans" (http://en.wikipedia.org/wiki/Human,_All_Too_Human)

PS: it's not only my first chrome extension, it's also my first question on stackoverflow, while I used it a lost in the past, but only read-only. Please be nice :-D

Updates:

  • 2013-10-13 : ok, problem solved, this was it : no comments in json files
  • 2013-10-13 : A part (only) of the bug is resolved thanks to @ChrisP: comments are not allowed in json files, which is sad but legitimate. https://github.com/getify/JSON.minify allows you to take json file with comments and output it minified without comments. Best of both worlds.
Community
  • 1
  • 1
jmfayard
  • 79
  • 7
  • Your manifest is not valid JSON. Remove all the comments, which are not allowed, and you should be good to go. – Métoule Oct 13 '13 at 07:40
  • Weird but true but legitimate but not enough to solve the bug. See my new commit on my github. By the way, if I understand correctly, I can't approve your future answer if it's only here :) – jmfayard Oct 13 '13 at 08:23
  • OK, I'll add a proper answer :) – Métoule Oct 13 '13 at 08:44

1 Answers1

8

Your manifest.json file contains comments:

{
  "name": "__MSG_name__", // {en}: "Search Tab in Chrome's Omnibox" 
  "description": "__MSG_description__",
  ...
}

which are not allowed in JSON, cf http://json.org/.

If you remove them, your manifest should be valid, and the error should disappear. You can find JSON parsers online to ensure it's valid, for example:

Métoule
  • 13,062
  • 2
  • 56
  • 84
  • Thank you ChrisP, this is definitely a necessary step to let Google's servers accept my little Chrome extension. Alas, this step is not sufficient, because after reading your comments and a thread dedicated to comments in JSON on stackoverflow (http://stackoverflow.com/questions/244777/can-i-comment-a-json-file) I have now removed the comments and Google's server keeps telling me the same error : **The manifest must define a version** I have updated my github repository https://github.com/internaciulo/search-tab-in-chrome-s-omnibox – jmfayard Oct 13 '13 at 09:40
  • That's very weird, I used the 'Download ZIP' link of your GitHub repository, and was able to successfully publish the extension. How do you compress your extension? – Métoule Oct 13 '13 at 09:52
  • with git... git archive --format zip --output "../search-tab-in-chrome-s-omnibox.zip" master -0 well well, I found it, I did correct the bug according to your response. but since I tried many things to resolve this stupid bug before, including trying to publish it on another name, I had two *zip file that look the same in the same directory, and of course I chose the wrong one :'( $ ls ../*zip` ../search-tab-in-chrome-s-omnibox.zip ../search-your-tabs-with-the-tab-keyword.zip – jmfayard Oct 13 '13 at 10:04
  • 1
    *I have a dream, that one day, computers understand how stupid we are :-)* Any way : THANKS A LOT :-D – jmfayard Oct 13 '13 at 10:05