angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open gkalpak opened this issue 8 years ago • 48 comments

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/[email protected]
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).

gkalpak avatar Jul 24 '18 12:07 gkalpak

Possible duplicate: https://github.com/angular/angular-cli/issues/11465

bave8672 avatar Jul 25 '18 01:07 bave8672

#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).

gkalpak avatar Jul 25 '18 08:07 gkalpak

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/[email protected]
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.

puku0x avatar Jul 26 '18 00:07 puku0x

Same here

proeben avatar Jul 26 '18 08:07 proeben

Same problem

jsongo avatar Jul 26 '18 11:07 jsongo

Same issues

guysenpai avatar Jul 26 '18 14:07 guysenpai

Someone kindly look into this asap. Thanks.

batbrain9392 avatar Jul 26 '18 18:07 batbrain9392

Same issue here as well.

jwuliger avatar Jul 27 '18 00:07 jwuliger

Same issues.

and, another project with PWA:

ng g m consumer

Error:

newTree.optimize is not a function

luisfelipediaz avatar Jul 27 '18 03:07 luisfelipediaz

This is still an issue after the CLI 6.1.1 release.

stevehipwell avatar Jul 27 '18 08:07 stevehipwell

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

ducdung8491 avatar Jul 27 '18 10:07 ducdung8491

Yup me too

adnathanail avatar Jul 28 '18 00:07 adnathanail

_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);
    }

voreiche avatar Jul 28 '18 15:07 voreiche

Possibly fixed by #11655.

gkalpak avatar Jul 29 '18 09:07 gkalpak

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

callawey avatar Jul 29 '18 11:07 callawey

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

gkalpak avatar Jul 29 '18 12:07 gkalpak

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

callawey avatar Jul 29 '18 12:07 callawey

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

VincentG85 avatar Jul 30 '18 06:07 VincentG85

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

batbrain9392 avatar Jul 30 '18 14:07 batbrain9392

@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.

VincentG85 avatar Jul 30 '18 14:07 VincentG85