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 doesn't work correctly in angular-cli 6.2.5 (Maximum call stack size exceeded) #12914

Closed
christianmorante opened this issue Nov 9, 2018 · 25 comments

Comments

@christianmorante
Copy link

christianmorante commented Nov 9, 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)

- [ ] 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: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • @angular/pwa@0.10.5
    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

@clydin
Copy link
Member

clydin commented Nov 9, 2018

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

@christianmorante
Copy link
Author

christianmorante commented Nov 9, 2018

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

@jakawell
Copy link

jakawell commented Nov 9, 2018

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

@christianmorante
Copy link
Author

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

@jakawell
Copy link

jakawell commented Nov 9, 2018

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

@alan-agius4
Copy link
Collaborator

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

@azaddjan
Copy link

No issue with bellow version. Update your cli.

ng version

Angular CLI: 7.0.5
Node: 10.11.0
Angular: 7.0.3

@alan-agius4 alan-agius4 changed the title ng add @angular/pwa doesn't work correctly in angular-cli 6.2.5 ng add @angular/pwa doesn't work correctly in angular-cli 6.2.5 (Maximum call stack size exceeded) Nov 11, 2018
@ngbot ngbot bot added this to the needsTriage milestone Nov 11, 2018
@tsukhu
Copy link

tsukhu commented Nov 14, 2018

@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/pwa@0.8.7)

@alan-agius4
Copy link
Collaborator

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",

@igwemagnusnnamdi65
Copy link

@jakawell thanks so much.You rock.

@imen-developer
Copy link

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

@jcuervas
Copy link

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

adamkasztenny added a commit to adamkasztenny/angular that referenced this issue Nov 28, 2018
@IgorMinar IgorMinar reopened this Nov 28, 2018
@IgorMinar
Copy link
Contributor

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.

@gkalpak
Copy link
Member

gkalpak commented Nov 28, 2018

peerDependency on what? Angular or cli/devkit?

@IgorMinar
Copy link
Contributor

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

@hansl hansl added the needs: discussion On the agenda for team meeting to determine next steps label Nov 29, 2018
@gkalpak
Copy link
Member

gkalpak commented Nov 29, 2018

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.

@IgorMinar
Copy link
Contributor

IgorMinar commented Nov 30, 2018 via email

@gkalpak
Copy link
Member

gkalpak commented Nov 30, 2018

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

jagomf added a commit to TrainingITCourses/final-jagomf that referenced this issue Dec 10, 2018
@marcobaccaro
Copy link

If you delete the node_modules folder it works fine.

@saurabhzh
Copy link

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

@hansl hansl removed the needs: discussion On the agenda for team meeting to determine next steps label Dec 20, 2018
clydin added a commit to clydin/angular-cli that referenced this issue Dec 23, 2018
…encies

If no version specifier is supplied `ng add` will now try to find the most recent version of the package that has peer dependencies that match the package versions supplied in the project's package.json

Fixes angular#12914
clydin added a commit to clydin/angular-cli that referenced this issue Dec 23, 2018
…encies

If no version specifier is supplied `ng add` will now try to find the most recent version of the package that has peer dependencies that match the package versions supplied in the project's package.json

Fixes angular#12914
alexeagle pushed a commit that referenced this issue Jan 8, 2019
…encies

If no version specifier is supplied `ng add` will now try to find the most recent version of the package that has peer dependencies that match the package versions supplied in the project's package.json

Fixes #12914
@alan-agius4
Copy link
Collaborator

Fixed via #13286

@nreynis
Copy link

nreynis commented Jan 29, 2019

@alan-agius4 It's not fixed, can you please reopen the issue ?

Just updated to @angular/cli:7.2.3 and the error is still here.
I've also deleted the node_modules directory and it still fails the same way.

Nevermind, I updated my global cli but didn't noticed the project was using an older one installed locally. Bumped both it's working fine now. Sorry for the trouble.

@cnscorpions
Copy link

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

it seems to work, thnk u

@MayumyCH
Copy link

MayumyCH commented Aug 7, 2019

@jakawell muchas gracias. Me funciono (y)

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests