Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest.json Unexpected Token

Hello I pushed a react/express project up to heroku (https://polar-oasis-57801.herokuapp.com/) and received the following errors in the console: Chrome console error messages

I tried looking up this error and it seems that I need to change something in my manifest.json file but I'm not sure. Any advice would help. Here's my manifest file:

{
  "short_name": "React App",
  "name": "Create React App Sample",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    }
  ],
  "start_url": ".",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}

And also my project on Github: https://github.com/bernar83/cat-cards

like image 762
Adrian Bernardo Avatar asked Mar 15 '19 07:03

Adrian Bernardo


1 Answers

This error means that the request to manifest.json does not return a valid JSON response. Probably it returns an HTML, given the fact that it fails because of a starting <.

Be sure to link the manifest.json correctly and make sure to preserve its integrity in the deployment process. Try to navigate to http://yoururl/manifest.json and check the result.

EDIT1: it seems like your link to the manifest is broken. In https://github.com/bernar83/cat-cards/blob/master/client/public/index.html , try replacing

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

with

<link rel="manifest" href="manifest.json" />

EDIT2: Just checked your Heroku link and can confirm the error. Your page tries to find the manifest.json under the path /cat-cards/manifest.json which is wrong. It should only be manifest.json

like image 167
gbalduzzi Avatar answered Sep 25 '22 16:09

gbalduzzi