Error adding `@angular/pwa` v0.7.0-rc.3
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
npm install --global @angular/cli@nextng new test-appcd test-appng 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).
Possible duplicate: https://github.com/angular/angular-cli/issues/11465
#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).
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.
Same here
Same problem
Same issues
Someone kindly look into this asap. Thanks.
Same issue here as well.
Same issues.
and, another project with PWA:
ng g m consumer
Error:
newTree.optimize is not a function
This is still an issue after the CLI 6.1.1 release.
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
Yup me too
_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);
}
Possibly fixed by #11655.
its not fixed on version 0.7.1 on #11655 problem still exists with a fresh project and on adding existing projects
Not sure what you mean. #11655 has not been released yet (and thus not included in 0.7.1) 😕
ohh sorry then, i thought its fixed in v0.7.0-rc.3 and it has been released as 0.7.1
For anyone looking for a workaround, you may rollback to @angular/cli@~6.0.0 with @angular/pwa@~0.6.0.
@VincentG85 : Are you sure reverting to 6.0.0 is solving it? Because when I'd tried, it gave another error.
@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.