Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng add @angular/pwa fails with 'Invalid rule result: Function().' #11663

Closed
mruknowme opened this issue Jul 26, 2018 · 14 comments · Fixed by #11954
Closed

ng add @angular/pwa fails with 'Invalid rule result: Function().' #11663

mruknowme opened this issue Jul 26, 2018 · 14 comments · Fixed by #11954

Comments

@mruknowme
Copy link

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [x] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node --version
v10.2.1
ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.8
Node: 10.2.1
OS: darwin x64
Angular: 6.0.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@angular/pwa                      0.7.0
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.8.3
npm --version
6.2.0

Repro steps

ng new projectName --routing --prefix=prfx --style=scss && cd projectName && ng add @angular/pwa

The log given by the failure

ng add @angular/pwa
Installing packages for tooling via npm.
+ @angular/pwa@0.7.0
updated 1 package and audited 26697 packages in 6.57s
found 13 vulnerabilities (9 low, 4 high)
  run `npm audit fix` to fix them, or `npm audit` for details
Installed packages for tooling via npm.
Invalid rule result: Function().

Mention any other details that might be useful

@bobweeman
Copy link

@mruknowme Do you have a solution yet. Am having the same issue.

@proeben
Copy link

proeben commented Jul 26, 2018

Same problem here. 6.1.0 doesnt work either (different error). I tried to downgrade and got this.

@gsphamnguyen
Copy link

You should to use @angular/pwa@0.6.8. Goodluck!

@gkalpak
Copy link
Member

gkalpak commented Jul 26, 2018

Sounds similar to #11640 (although the error message is different).

@hansl
Copy link
Contributor

hansl commented Jul 26, 2018

This is due to a new feature in Schematics that you can now return a Rule in a Schematics. Unfortunately, that means some Schematics are not backward compatible.

We will release a patch that will fix this, but in the meantime you can update @angular-devkit/schematics to 0.7.0 and it will fix the issue.

@Shubedobedo
Copy link

@hansl after updating now I get "Path "/ngsw-config.json" already exist."

@odineshrao
Copy link

odineshrao commented Jul 27, 2018

Same problem, i thing there is bugs in pwa@0.7.1, you need to use lower version, after that works fine

@dgpuranik
Copy link

@hansl I am using @angular-devkit/schematics 0.7.1. I still get same error. @odineshrao I tried installing lower version pwa@0.7.0 but still get same error. Do you know which lower version work proper?

@dgpuranik
Copy link

@odineshrao 0.6.8 worked.

@durdevic
Copy link

durdevic commented Aug 8, 2018

Hi guys, with 0.6.8 version I get newTree.optimize is not a function . I couldn't find a solution to this, does anybody have any idea?

@durdevic
Copy link

The solutions that worked for me in the end was from sksvenson https://stackoverflow.com/questions/51555017/path-ngsw-config-json-already-exists

I had the same issue. I came from Angular 5 and updated to Angular 6.

I use these specific versions to get it work:

npm install --save @angular/cli@6.0.8
npm install --save @angular/pwa@0.6.8

And I had also to remove this entry from angular.json:

"ngswConfigPath": "src/ngsw-config.json"

@johnpaulmanoza
Copy link

The solution that worked for me is to downgrade to version 6.0.0.

@ohabash
Copy link

ohabash commented Sep 18, 2018

none of these solution works. how come when i do ng g c cname i get Invalid rule result: Function().

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.