简体   繁体   中英

create-react-app: Site cannot be installed: no matching service worker detected

I have this issue, i'm trying to add my React app to Homescreen.

manifest.json

{
  "short_name": "Ridnois",
  "name": "Ridnois - Amazing store (dev)",
  "icons": [
    {
      "src": "r-ico-144px.png",
      "sizes": "144x144",
      "type": "image/x-ico"
    }
  ],
  "start_url": "./index.html",
  "display": "standalone",
  "theme_color": "#fefefe",
  "background_color": "#fefefe"
}

Doing this, i get this error:

Site cannot be installed: a 144px square PNG icon is required, but no supplied icon meets this requirement

Then i tried to change the type of the icon:

"type":"image/png"

But i get this error:

Site cannot be installed: no matching service worker detected. You may need to reload the page, or check that the service worker for the current page also controls the start URL from the manifest

My icon png image is 144x144px, i created the template of my app with ReactJs, my serviceWorker works fine.

Allow me to share snaps of what worked for me:

manifest.json

在此处输入图片说明

public folder contents

在此处输入图片说明

index.html

在此处输入图片说明

Seems Chrome wanted at least 144x144 maybe someone with more on why this worked could edit this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM