无法安装渐进式网络应用程序站点:没有可用于显示的图标

sud*_*ang 5 reactjs progressive-web-apps web-manifest create-react-app

我正在构建一个渐进的Web应用程序.我从create-react-app开始使用样板文件.然后我添加了一个Web应用程序清单.

应用程序/公/ 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"
}
Run Code Online (Sandbox Code Playgroud)

将此链接到 index.html

应用程序/公/ 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>
Run Code Online (Sandbox Code Playgroud)

我使用了生成图标realfavicongenerator.net并将它们放在公共目录中.

我正在部署我的应用程序gh-pages.当我尝试时Add to homescreen,我得到以下错误

我认为我在webmanifest中为图标做错了.

Tru*_*gDQ 10

您的图标路径引用根目录.

更改"src": "/android-chrome-192x192.png","src": "android-chrome-192x192.png",(不含/开头).