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

ng add @angular/pwa doesn't work correctly in angular-cli 6.2.5 (Maximum call stack size exceeded)

Open christianmorante opened this issue 8 years ago • 25 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)

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

Versions

Angular CLI: 6.2.5 Node: 8.11.3 OS: win32 x64 Angular: 6.1.10 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.8.5 @angular-devkit/build-angular 0.8.5 @angular-devkit/build-optimizer 0.8.5 @angular-devkit/build-webpack 0.8.5 @angular-devkit/core 0.8.5 @angular-devkit/schematics 0.8.5 @angular/cdk 6.4.7 @angular/cli 6.2.5 @angular/material 6.4.7 @angular/pwa 0.10.5 @ngtools/webpack 6.2.5 @schematics/angular 0.8.5 @schematics/update 0.8.5 rxjs 6.2.2 typescript 2.9.2 webpack 4.20.2

Repro steps

ng new pwademo ng add @angular/material ng build --prod ng add @angular/pwa

The log given by the failure

Installing packages for tooling via npm. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • @angular/[email protected] updated 1 package in 47.645s Installed packages for tooling via npm. Maximum call stack size exceeded

Desired functionality

The command doesnt add automatically PWA features to my Angular application such as manifest file or icons in assets folder or edit my index.html file with reference to manifest, only show me the error message Maximum call stack size exceeded

Mention any other details that might be useful

christianmorante avatar Nov 09 '18 20:11 christianmorante

Currently you will need to execute ng add @angular/pwa@v6-lts to ensure the version compatible with Angular 6 is used.

clydin avatar Nov 09 '18 20:11 clydin

I'm just running the command ng add @angular/pwa but its take a long time to show me error message: Maximum call stack size exceeded

christianmorante avatar Nov 09 '18 20:11 christianmorante

I'm having the same issue. I was able to get it to work by specifying the previous stable release: ng add @angular/[email protected] --project my-project-name

jakawell avatar Nov 09 '18 21:11 jakawell

Oh hell, it worked for me. But is there any clue as to why? Thanks @jakawell.

christianmorante avatar Nov 09 '18 21:11 christianmorante

I'm not sure. The latest version was just published recently, so I'm guessing something isn't quite right with it.

jakawell avatar Nov 09 '18 22:11 jakawell

The latest version is targeted to be used with Version 7.

alan-agius4 avatar Nov 10 '18 14:11 alan-agius4

No issue with bellow version. Update your cli.

ng version

Angular CLI: 7.0.5 Node: 10.11.0 Angular: 7.0.3

azaddjan avatar Nov 11 '18 01:11 azaddjan

@0.8.7

I am using nx extensions cli v7 and angular cli 7.0.5 and ran into the same issue. @jakawell thanks for your solution , that one works (using the older version/stable version of @angular/[email protected])

tsukhu avatar Nov 14 '18 06:11 tsukhu

Hi, the problem is no longer reproducable if you use the latest versions of the CLI and devkit packages.

    "@angular-devkit/build-angular": "^0.10.5",
    "@angular/cli": "^7.0.5",

alan-agius4 avatar Nov 14 '18 08:11 alan-agius4

@jakawell thanks so much.You rock.

igwemagnusnnamdi65 avatar Nov 15 '18 07:11 igwemagnusnnamdi65

it should be fixed by updating your global angular cli to the last stable version

imen-developer avatar Nov 19 '18 13:11 imen-developer

"@angular-devkit/build-angular": "^0.10.5", "@angular/cli": "^7.0.5", This worked for me also (in project package.json)

jcuervas avatar Nov 26 '18 15:11 jcuervas

The root cause here is that the @angular/pwa doesn't declare any peerDependency in the package.json config, so the npm client installs the latest one which doesn't seem to be compatible. To fix this we need to define a peerDep on the right version.

To fix this for v6 developers, we might need to cut a version that is compatible with v6 and declares a peerDep on v6.

IgorMinar avatar Nov 28 '18 17:11 IgorMinar

peerDependency on what? Angular or cli/devkit?

gkalpak avatar Nov 28 '18 19:11 gkalpak

on the cli because it's the cli that provides schematics and other stuff needed by @angular/pwa

IgorMinar avatar Nov 29 '18 02:11 IgorMinar

Makes sense. I just want to point out that some parts (such as the ngsw-config.json) must be compatible with the @angular/service-worker version used. Maybe we should move them to @angular/service-worker and have cli somehow get them from there.

gkalpak avatar Nov 29 '18 07:11 gkalpak

since cli and the framework are aligned on major versions, it should be fine to pin pwa to just cli. no?

On Wed, Nov 28, 2018 at 11:48 PM George Kalpakas [email protected] wrote:

Makes sense. I just want to point out that some parts (such as the ngsw-config.json) must be compatible with the @angular/service-worker version used. Maybe we should move them to @angular/service-worker and have cli somehow get them from there.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/12914#issuecomment-442737821, or mute the thread https://github.com/notifications/unsubscribe-auth/AANM6EB0KHPxEyQZ9wauacG9722gYHE9ks5uz5FVgaJpZM4YXdGF .

IgorMinar avatar Nov 30 '18 16:11 IgorMinar

If we only change things related to the ngsw-config in major versions, yes.

gkalpak avatar Nov 30 '18 17:11 gkalpak

If you delete the node_modules folder it works fine.

marcobaccaro avatar Dec 11 '18 22:12 marcobaccaro

For my case I updated my angular CLI and then 'ng add @angular/pwa' is working fine. To update Angular CLI in your project use:

npm uninstall --save-dev angular-cli npm install --save-dev @angular/cli@latest

saurabhzh avatar Dec 15 '18 11:12 saurabhzh