Angular 7 PWA - Manifest fetch failed (status: 404) at Driver

99封情书 提交于 2021-01-02 22:38:11

问题


Uncaught (in promise) Error: Manifest fetch failed! (status: 404) at Driver. (ngsw-worker.js:2368) at Generator.next () at fulfilled (ngsw-worker.js:1780)

After deploy my angular 7 project (PWA) got this error. any solution?


回答1:


I had the same problem and I found the solution here.

If you upload a .json file to your Windows Azure website and try to access it, it would give you a 404 File Not Found error because the MIME Type of .json is not set by default. This also applies in general to any file that might need a specific MIME Type.

To fix this issue, FTP into your website and upload the following Web.config file which will set the correct MIME types. If you already have a Web.config file in place, just add the below to the appropriate section.

Web.config:

<?xml version="1.0"?>

<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".json" mimeType="application/json" />
      </staticContent>
   </system.webServer>
</configuration> 



回答2:


I had a similar issue...

Failed to load manifest.webmanifest . A ServiceWorker passed a promise to FetchEvent.respondWith() that resolved with non-Response value ‘undefined’.

My manifest name was manifest.webmanifest and I had added some filters to my service worker to serve static files only.
Because of .webmanifest extension, it didn't recognize as static content and when the client is offline it failed to serve from cache.

I solved this issue by simply renaming it to manifest.json.

Hope this prevents someone's headache... :)




回答3:


in your angular.json

"serviceWorker: true"  

and update

npm install @angular-devkit/build-angular@latest



回答4:


Make sure your ngsw-config.json configured properly and in your angular.json file, find and change to serviceworker: true.

Also in your angular.json, check if "src/manifest.json", is listed inside "assets" array.

Verify by: https://yourdomain.com/manifest.json is accessible.

Hope this will work.




回答5:


Adding the below line in the web.config solved the issue.

<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
 </staticContent>


来源:https://stackoverflow.com/questions/56952146/angular-7-pwa-manifest-fetch-failed-status-404-at-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!