Reputation: 1330
After deploy my angular 7 project (PWA) got this error. any solution?
Uncaught (in promise) Error: Manifest fetch failed! (status: 404) at Driver. (ngsw-worker.js:2368) at Generator.next () at fulfilled (ngsw-worker.js:1780)
Upvotes: 7
Views: 10679
Reputation: 1
As per the other answers, yes you have to add a web.config file, you can just put it inside the dist/(proyect_name)/ folder before deploying and it should work fine.
Upvotes: 0
Reputation: 1462
I resolved this issue by adding web.config file in my dist folder
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".webmanifest" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
Upvotes: 1
Reputation: 1622
I've resolved my issue by this simple steps:
go to angular.json
in root folder.
add src/manifest.json
in /assets. If your manifest.json is already in /src folder, otherwise add the path instead.
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
restart dev server using
ng serve
or ng serve -o
to open the project
Upvotes: 4
Reputation: 3694
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.
Upvotes: 0
Reputation: 725
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... :)
Upvotes: 2
Reputation: 1330
Adding the below line in the web.config solved the issue.
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
Upvotes: 1
Reputation: 3389
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 a404 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 aWeb.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>
Upvotes: 6
Reputation: 5742
in your angular.json
"serviceWorker: true"
and update
npm install @angular-devkit/build-angular@latest
Upvotes: 0