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

Error adding `@angular/pwa` v0.7.0-rc.3 #11640

Closed
gkalpak opened this Issue Jul 24, 2018 · 47 comments

Comments

Projects
None yet
@gkalpak
Member

gkalpak commented Jul 24, 2018

Bug Report or Feature Request (mark with an x)

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

Command (mark with an x)

- [x] add

Versions

> node --version
v8.11.3

> npm --version
5.6.0

> ng --version
Angular CLI: 6.1.0-rc.3
Node: 8.11.3
OS: win32 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.7.0-rc.3
@angular-devkit/build-angular     0.7.0-rc.3
@angular-devkit/build-optimizer   0.7.0-rc.3
@angular-devkit/build-webpack     0.7.0-rc.3
@angular-devkit/core              0.7.0-rc.3
@angular-devkit/schematics        0.7.0-rc.3
@angular/cli                      6.1.0-rc.3
@angular/pwa                      0.7.0-rc.3
@ngtools/webpack                  6.1.0-rc.3
@schematics/angular               0.7.0-rc.3
@schematics/update                0.7.0-rc.3
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.9.2

OS: Windows 10

Repro steps

  1. npm install --global @angular/cli@next
  2. ng new test-app
  3. cd test-app
  4. ng add @angular/pwa@next --project=test-app

The log given by the failure

Installing packages for tooling via npm.
+ @angular/pwa@0.7.0-rc.3
added 2 packages in 12.443s
Installed packages for tooling via npm.
Path "/ngsw-config.json" already exist.

Npm dependencies are updated (including package.json and package-lock.json), but the add command is not completed (no ngsw-config.json, no manifest.json, no changes in index.html, etc).

@bave8672

This comment has been minimized.

bave8672 commented Jul 25, 2018

Possible duplicate: #11465

@gkalpak

This comment has been minimized.

Member

gkalpak commented Jul 25, 2018

#11465 is a little different. It is using cli@next with pwa@latest (which does indeed through that error, but I think it is expected due to "version mismatch" (in a sense)).

This issue is about cli@next + pwa@next, which should be compatible (and cause a different breakage than the one reported in #11465).

@puku0x

This comment has been minimized.

Contributor

puku0x commented Jul 26, 2018

I faced the same problem with the latest CLI.

> ng -v
Angular CLI: 6.1.0
Node: 8.9.4
OS: darwin x64
Angular: 6.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.0
@angular-devkit/build-angular     0.7.0
@angular-devkit/build-optimizer   0.7.0
@angular-devkit/build-webpack     0.7.0
@angular-devkit/core              0.7.0
@angular-devkit/schematics        0.7.0
@angular/pwa                      0.7.0
@ngtools/webpack                  6.1.0
@schematics/angular               0.7.0
@schematics/update                0.7.0
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.9.2
$ ng add @angular/pwa --project=my-app
Installing packages for tooling via npm.
+ @angular/pwa@0.7.0
updated 1 package and audited 29133 packages in 10.227s
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.
Path "/ngsw-config.json" already exist.
@proeben

This comment has been minimized.

proeben commented Jul 26, 2018

Same here

@jsongo

This comment has been minimized.

jsongo commented Jul 26, 2018

Same problem

@guysenpai

This comment has been minimized.

guysenpai commented Jul 26, 2018

Same issues

@batbrain9392

This comment has been minimized.

batbrain9392 commented Jul 26, 2018

Someone kindly look into this asap. Thanks.

@jwuliger

This comment has been minimized.

jwuliger commented Jul 27, 2018

Same issue here as well.

@luisfelipediaz

This comment has been minimized.

luisfelipediaz commented Jul 27, 2018

Same issues.

and, another project with PWA:

ng g m consumer

Error:

newTree.optimize is not a function

@stevehipwell

This comment has been minimized.

stevehipwell commented Jul 27, 2018

This is still an issue after the CLI 6.1.1 release.

@ducdung8491

This comment has been minimized.

ducdung8491 commented Jul 27, 2018

https://github.com/ducdung8491/angular-cli/blob/master/packages/angular_devkit/core/src/virtual-fs/host/memory.ts#L197

Khi tạo ngsw-config.json phương thức _rename(from, to) của SimpleMemoryHost có check to
trên _cache, vì nó đã tồn tại nên có ngoại lệ FileAlreadyExistException

@adnathanail

This comment has been minimized.

adnathanail commented Jul 28, 2018

Yup me too

@voreiche

This comment has been minimized.

voreiche commented Jul 28, 2018

_rename(from, to) does not check for from and to (after normalization) are identical.

  protected _rename(from: Path, to: Path): void {
    from = this._toAbsolute(from);
    to = this._toAbsolute(to);

    ** if (from == to) return ** is missing

    if (!this._cache.has(from)) {
      throw new FileDoesNotExistException(from);
    } else if (this._cache.has(to)) {
      throw new FileAlreadyExistException(to);
    }

@gkalpak gkalpak referenced this issue Jul 29, 2018

Closed

PWA Issue #25187

@gkalpak

This comment has been minimized.

Member

gkalpak commented Jul 29, 2018

Possibly fixed by #11655.

@callawey

This comment has been minimized.

callawey commented Jul 29, 2018

its not fixed on version 0.7.1 on #11655 problem still exists with a fresh project and on adding existing projects

@gkalpak

This comment has been minimized.

Member

gkalpak commented Jul 29, 2018

Not sure what you mean. #11655 has not been released yet (and thus not included in 0.7.1) 😕

@callawey

This comment has been minimized.

callawey commented Jul 29, 2018

ohh sorry then, i thought its fixed in v0.7.0-rc.3 and it has been released as 0.7.1

@VincentG85

This comment has been minimized.

VincentG85 commented Jul 30, 2018

For anyone looking for a workaround, you may rollback to @angular/cli@~6.0.0 with @angular/pwa@~0.6.0.

@batbrain9392

This comment has been minimized.

batbrain9392 commented Jul 30, 2018

@VincentG85 : Are you sure reverting to 6.0.0 is solving it? Because when I'd tried, it gave another error.

@VincentG85

This comment has been minimized.

VincentG85 commented Jul 30, 2018

@batbrain9392 Did you also revert @angular/pwa ?
It really doesn't solve the problem, it's only a workaround.
Hopefully a fix will be released soon.

@virlliNia

This comment has been minimized.

virlliNia commented Jul 31, 2018

ng add @angular/pwa@0.6.8 --project <name project as package.json>

It works for me, from #11663

@batbrain9392

This comment has been minimized.

batbrain9392 commented Jul 31, 2018

@virlliNia : I tried what u specified.

Project name in package.json : ng-universal
ng add @angular/pwa@0.6.8 --project ng-universal
Error : Project 'ng-universal' could not be found in workspace.

Project name in angular.json : ngUniversal
ng add @angular/pwa@0.6.8 --project ngUniversal
Error : Data path "" should NOT have additional properties(title).

@alexandremoore

This comment has been minimized.

alexandremoore commented Jul 31, 2018

@batbrain9392 you also need to use cli v6.0.8.

@alokeDcoder

This comment has been minimized.

alokeDcoder commented Aug 1, 2018

@virlliNia after folloeing your suggestion , i also followed @alexandremoore, and then it fixed my issue.

@bamboozooled

This comment has been minimized.

bamboozooled commented Aug 5, 2018

@batbrain9392 were you able to fix it? Having same issue.

@batbrain9392

This comment has been minimized.

batbrain9392 commented Aug 6, 2018

@bamboozooled : Yeah, I could..

  1. npm i -g @angular/cli@6.0.8
  2. ng new projectName
  3. ng add @angular/pwa@0.6.8
@gkalpak

This comment has been minimized.

Member

gkalpak commented Aug 6, 2018

This seems to have been fixed (by #11655) and works fine with the beta versions:

  • @angular/cli@next (v6.2.0-beta.1)
  • @angular-devkit/build-angular@next (v0.8.0-beta.0)
  • @angular/pwa@next (v0.8.0-beta.1)

@gkalpak gkalpak closed this Aug 6, 2018

@batbrain9392

This comment has been minimized.

batbrain9392 commented Aug 6, 2018

@gkalpak : Although pwa works, since this version has new changes in angular.json, ng add @angular/material does not work.
Error : Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration.

@gkalpak

This comment has been minimized.

Member

gkalpak commented Aug 6, 2018

@batbrain9392: That is totally unrelated to the current issue. Feel free to open a new one, if you think there is something broken with @angular/material.

@PeS82

This comment has been minimized.

PeS82 commented Aug 6, 2018

@gkalpak The issue is that since around CLI v 6.1.0 various commands that used to work just don't. ng g c, ng g m, this one etc. We do downgrades and upgrades of CLI to get different parts working, delete and reinstall node_modules; for some that works, for some it doesn't. It is like real alchemy to get something working and overall it is frustrating. I seriously regret updating to CLI 6.1.1, that's when my problems started.

Now this issue is closed and suggestion is - as I understand it - to make basically Sophie's choice between PWA and Material.

Don't get me wrong, I really appreciate CLI. Usually it does very good job and is great help at routine tasks. Just recently way too many frequently used commands and functionality seems to be broken and there is no way in stable releases get all that sweet functionality working :(

Sorry about the rant probably just needed to vent the frustration.

@gkalpak

This comment has been minimized.

Member

gkalpak commented Aug 6, 2018

Sorry to hear you are frustrated 😞

Just to be clear, there is no suggestion to choose between PWA and material. Both should work (and if they don't, they need to be fixed).

This issue was about @angular/pwa not working with latest cli. This problem has been fixed.

If there is also a problem with @angular/material (I'm not aware of that), please open a new issue. That way, the cli team will be aware of that and fix it too \o/

@clydin

This comment has been minimized.

Member

clydin commented Aug 6, 2018

@PeS82 Please also note that the error shown above and caused by ng add @angular/material, is actually generated by material itself and not the CLI. The relevant code is here: https://github.com/angular/material2/blob/master/src/lib/schematics/install/theming.ts#L26

@PeS82

This comment has been minimized.

PeS82 commented Aug 6, 2018

I know there was no explicit suggestion to choose between PWA and Material. But based on @batbrain9392 comment I understand it that I can get adding PWA working by updating to versions you mentioned but since the angular.json structure is changed I cannot add material later. At least for the moment being.

Today I spent couple of hours diffing angular.json of project updated from Angular 5.x and new one trying to figure out why in the old one ng g c|m doesn't work while in the new one does. Couldn't find any difference in installed versions or config.

So I decided to move on and add PWA to the new project and work there and found out I can't. And that threw me over the top (if that means in English what I think it means) 😀

It is good to hear that this issue is fixed, however the overall experience lately is really frustrating.

Just ignore me, maybe it's the never-ending heat this summer that got me too, switching PC off and going to swim, maybe it will help 😁

@bamboozooled

This comment has been minimized.

bamboozooled commented Aug 6, 2018

@batbrain9392 Did not still work. I had to eventually add pwa functionality manually as adding @angular/pwa does not work in my existing app.

@b-mi

This comment has been minimized.

b-mi commented Aug 9, 2018

A lot of circular references between issues because of 'duplicate'. It looks like finding similar problem between issues is solution, then issue closed. Please, do not enter wanna be - not tested solutions and information about may be "duplicate issue" and close. When you solve problem, then close all issues about problem. We now have to click between issues without finding solution.

@Dispersia

This comment has been minimized.

Dispersia commented Aug 9, 2018

@b-mi what are you referring to? All issues should point to this one, that got fixed, and is now closed.

@b-mi

This comment has been minimized.

b-mi commented Aug 9, 2018

Dispersia, circular references to issues are here in common.

This issue is not fixed:

During standard installing (not beta versions):
ng add @angular/pwa

  • @angular/pwa@0.7.2
    added 5 packages in 13.831s
    Installed packages for tooling via npm.
    Could not find index file for the project

ng add @angular/material

  • @angular/material@6.4.3
    added 2 packages in 13.652s
    Installed packages for tooling via npm.
    Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration

Even, now looks like ng add @angular/material do not install @angular/cdk

ERROR in node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(8,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(9,56): error TS2307: Cannot find module '@angular/cdk/overlay'.

@Dispersia

This comment has been minimized.

Dispersia commented Aug 9, 2018

How are any of those circular, nor do they have to deal with the issue that this issue was meant to address? And are those currently existing issues? Where are the issue number for them?

@abhishek1716

This comment has been minimized.

abhishek1716 commented Aug 9, 2018

This is just the turnaround after reading many slackoverflow and github solution.
I was successfully able to add angular material when my @angular/cli was at version 6.1.2 -->
then to add Pwa I downgrade the @angular/cli version to 6.0.8 and after I successfully added PWA again I upgraded the @angular/cli to next version v6.2.0-beta.1 then I upgraded my angular/core and angular/material.

My cli code-

**

npm install --save @angular/cli@6.1.2
ng new project
ng add @angular/material
npm install --save @angular/cli@6.0.8
ng add @angular/pwa
npm install --save @angular/cli@next
ng update @angular/core
ng update @angular/material

**

Hope this workaround works for you.

My Version at the moment
@angular/cli - 6.2.0-beta.1
@angular/material & @angular/cdk - 6.4.3
@angular/pwa - 0.6.8

@sjohnson32

This comment has been minimized.

sjohnson32 commented Aug 9, 2018

Thank you abhishek1716! I've been struggling with this for a couple hours. Working solution for a mess of a problem.

@b-mi

This comment has been minimized.

b-mi commented Aug 10, 2018

Dispersia, this issue have reference to issues number 11465, 11666, 11662, 11663, 11655, 11839. Every of this issues have references too. We jump from issue to issue and back, and we see how are they "closed", but the issue was not really solved.

No, issue is not solved - I tried it yesterday (without tricks as downgrade and beta versions (because it can cause some another problem - I want to have libraries actual)) and the result was in my prev comment.

@webmaxru

This comment has been minimized.

Member

webmaxru commented Aug 13, 2018

I confirm: it works with

npm install @angular/cli@next -g
...
ng add @angular/pwa@next

Version info:

Angular CLI: 6.2.0-beta.2
Node: 8.11.3
OS: darwin x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.0-beta.2
@angular-devkit/build-angular     0.8.0-beta.2
@angular-devkit/build-optimizer   0.8.0-beta.2
@angular-devkit/build-webpack     0.8.0-beta.2
@angular-devkit/core              0.8.0-beta.2
@angular-devkit/schematics        0.8.0-beta.2
@angular/cli                      6.2.0-beta.2
@angular/pwa                      0.8.0-beta.2
@ngtools/webpack                  6.2.0-beta.2
@schematics/angular               0.8.0-beta.2
@schematics/update                0.8.0-beta.2
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.16.5
@reyco1

This comment has been minimized.

reyco1 commented Aug 13, 2018

I also just confirmed that it works with

npm install @angular/cli@next -g
...
ng add @angular/pwa@next

Although, now I get the following error when trying to add material using

ng add @angular/material

Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration

@jwuliger

This comment has been minimized.

jwuliger commented Aug 13, 2018

I can also report the issue that @reyco1 is experiencing. I suspect it is because of stable vs 'next' but here is my console output:

ng add @angular/material
Installing packages for tooling via yarn.
yarn add v1.9.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "win32" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @angular/material@6.4.4" has unmet peer dependency "@angular/cdk@6.4.4".
[4/4] Building fresh packages...

success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @angular/material@6.4.4
info All dependencies
└─ @angular/material@6.4.4
Done in 6.79s.
Installed packages for tooling via yarn.
Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration
@paulimfavarato

This comment has been minimized.

paulimfavarato commented Aug 13, 2018

@reyco1 I got no erros when using Snapshot Build
npm install --save angular/material2-builds angular/cdk-builds angular/animations-builds

@danieldiazastudillo

This comment has been minimized.

danieldiazastudillo commented Aug 13, 2018

Still not working. Even downgrading CLI or everything else. Keeps showing "Path 'ngsw-config.json' already exists" and it doesn't...

@jeanmazc

This comment has been minimized.

jeanmazc commented Aug 14, 2018

Same here on #11853

Angular CLI: 6.2.0-beta.2
Node: 10.8.0
OS: win32 x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment