The update went fine, but now when I build, I get the following error.
Error: Expected to find an ngsw-config.json configuration file in the /Users/nathanielmay/Code/firebaseTest folder. Either provide one or disable Service Worker in your angular.json configuration file.
I looked in my angular.json
and found that on this line:
"ngswConfigPath": "/src/ngsw-config.json",
Property ngswConfigPath is not allowed.
I can't find an api for the new angular.json, but it seems as if I need to specify the path in a different way.
ng update @angular/pwa
didn't work either.
How can I resolve this error?
Please make sure to build your app in root folder. I had the same issue and building from the root folder solved my issue.
I'm not sure how "ngswConfigPath": "/src/ngsw-config.json"
, was added, but I removed it and it built fine.
Next issue I faced was that ngsw-config.json
has been moved out of src
and to the project root during the upgrade. I had to copy my updates into the root ngsw-config.json
for the service worker to register properly.
For my case issue was connected with /
sign added at the front of the path, so instead of "ngswConfigPath": "/src/ngsw-config.json"
I've used "ngswConfigPath": "src/ngsw-config.json"
and issue fixed.
Actually the file ngsw-config.json is generated but is on a different location.
First disable Service Worker in your angular.json/angular-cli.json configuration file. Then run ng build --prod
on your terminal. It should run without errors.
Then enable the service worker in your angular.json/angular-cli.json and run the ng build --prod
command again in your terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With