progressive web app site cannot be installed: no icon available to display
Asked Answered
A

1

5

I'm building a progressive web app. I started off with boilerplate from create-react-app. Then I added a web app manifest.

app/public/manifest.json

{
    "short_name": "First Contributions",
    "name": "First Contributions",
    "icons": [
        {
            "src": "/android-chrome-192x192.png",
            "sizes": "192x192",
            "type": "image/png"
        },
        {
            "src": "/android-chrome-256x256.png",
            "sizes": "256x256",
            "type": "image/png"
        }
    ],
    "theme_color": "#ffffff",
    "background_color": "#ffffff",
    "display": "standalone",
    "start_url": "index.html"
}

Linked this to index.html

app/public/index.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
    <title>First Contributions</title>
  </head>
  <body>
    <div id="root"></div>
      <script>
        if ('serviceWorker' in navigator) {
          navigator.serviceWorker.register('service-worker.js').catch(function(ex) {
            console.warn(ex);
            console.warn('(This warning can be safely ignored outside of the production build.)');
          });
        }
      </script>
    </body>
  </html>

I've generated icons using realfavicongenerator.net and put them in public directory.

I'm deploying my app using gh-pages. When I try to Add to homescreen, I get the following errors

I think I'm doing something wrong in webmanifest for icons.

Astrakhan answered 9/4, 2017 at 13:32 Comment(0)
F
11

Your icon paths reference to the root directory.

Change "src": "/android-chrome-192x192.png", to "src": "android-chrome-192x192.png", (without / at the beginning).

Fictile answered 9/4, 2017 at 14:12 Comment(1)
In my case I forgot the binary option in send, nodejs, I have to do it: https://stackoverflow.com/a/5826883/7173478 just make sure, fellas, that yall are doing itFilter

© 2022 - 2024 — McMap. All rights reserved.