Adding @angular/pwa issue

Hi, i’m following a josh morony tutorial about adding service workers to your ionic 4 app:

On of the first steps is to execute: ng add @angular/pwa --project < app-name >

However this results in the following error:


i’ve tried googling this but i cant seem to find a similar issue.

my node version is 8.11.4
angular version : 6.0.9
ionic version 4.0.0-beta.2

Any help would be appreciated

  • not sure, but, is maybe your global angular cli outdated?

  • or maybe somewhere a node version problem?

Fixed it by installing @angular/cli@latest. It seems it was using the outdated version angular-cli.

However running the command now throws a Invalid rule result: Function(). .

it did however add the angular/pwa package on version 0.7.4. Somehow i expected this to line up with the other versions ie. 6.0.9

maybe there is an incompatibility since you installed the last pwa package and you are still using older angular libs…maybe try to upgrade angular dependencies?

I found an open github issue regarding this error. Reverting to an older version of pwa seems to be the fix. How do you mean using older angular libs ?

"@angular/animations": "6.1.3",
"@angular/cdk": "6.4.5",
"@angular/common": "6.1.3",
"@angular/compiler": "6.1.3",
"@angular/core": "6.1.3",
"@angular/forms": "6.1.3",
"@angular/http": "6.1.3",
"@angular/material": "6.4.5",
"@angular/platform-browser": "6.1.3",
"@angular/platform-browser-dynamic": "6.1.3",
"@angular/platform-server": "6.1.3",
"@angular/pwa": "^0.7.4",
"@angular/router": "6.1.3",

P.S.: These are compatible respectively I don’t face that error, not in Ionic app but in my website

It was indeed me having outdated angular version. I just got back from vacation and the dev team and i thought 6.0.9 was still the latest. Thanks.

1 Like

Cool, nice to hear it worked out

P.S:: About dependencies version, is awesome. I run the cmd ncu like every week to see what dependencies aren’t updated anymore, really handy



1 Like