Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest is not valid JSON. Line: 1, column: 1, Unexpected token

keep getting this error: "Manifest is not valid JSON. Line: 1, column: 1, Unexpected token." i don't understand what the issue is with my code? here is what i have so far:

{
    "manifest_version": 2,
    "name": "extension",
    "version": "1.0",
    "description": "My first Chrome extension.",
    "browser_action": {
        "default_icon": "icon.jpg",
        "popup": "popup.html"
    }
}
like image 468
Joseph Young Avatar asked Nov 17 '15 13:11

Joseph Young


3 Answers

I added crossorigin attribute its worked.

<link rel="manifest" crossorigin="use-credentials" href="%PUBLIC_URL%/manifest.json" />
like image 79
ANIL PATEL Avatar answered Oct 31 '22 09:10

ANIL PATEL


I had my manifest.json File Properties set with Build Action: None, in Visual Studio 2010.

Changing, in Visual Studio, to Content ensured the file was transferred when I deployed.

enter image description here

Maybe yours is a similar issue.

Edit

Given my downvote I thought I should expand and say that my point was that, given that at line 1, column 1 there is valid json, it is more likely that you are getting a 404 http response than the actual json file returned.

So maybe the file isn't in the correct place or the server doesn't have permissions or whatever but the above is what had gone wrong with mine. Admittedly it is maybe too specific to what had gone wrong with mine and not definitely what was wrong with yours.

But the general point still stands, it's more likely caused by web server returning an http response for the json file, check the response in the network log in your browser.

like image 11
Snoophogg Avatar answered Oct 31 '22 09:10

Snoophogg


Content-type

Check the Content-Type of manifest.json in the Network tab. This needs to be application/json instead of text/html.

If you have wrong content-type, you may need to configure the settings of your webserver to correctly serve json files.

In my case I had to add it to the nginx sites-enabled file:

location ~* .(jpg|jpeg|gif|png|css|js|ico|xml|svg|json)$

like image 7
Datsos Avatar answered Oct 31 '22 08:10

Datsos