Angular-cli: Angular CLI 1.5.0-rc.6 does not support @angular/[email protected]

Created on 30 Oct 2017  路  18Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

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

Versions.

ng -v

Angular CLI: 1.5.0-rc.6
Node: 8.5.0
OS: win32 x64
Angular: 5.0.0-rc.8
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cdk: 2.0.0-beta.12
@angular/cli: 1.5.0-rc.6
@angular/material: 2.0.0-beta.12
@angular/service-worker: 5.0.0-rc.8
@angular-devkit/build-optimizer: 0.0.31
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.34
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0-rc.6
@schematics/angular: 0.0.48
typescript: 2.5.3
webpack: 3.8.1

Repro steps.

ng build --prod --aot --base-href=.

The log given by the failure.

*Build fails with error: *

The installed version of @angular/service-worker is 5.0.0-rc.8. This version of the CLI
requires the @angular/service-worker version to satisfy >= 1.0.0-beta.5 < 2.0.0. Please upgrade
your service worker version.
Error: The installed version of @angular/service-worker is 5.0.0-rc.8. This version of the CLI
requires the @angular/service-worker version to satisfy >= 1.0.0-beta.5 < 2.0.0. Please upgrade
your service worker version.

Desired functionality.

The newest @angular/cli isn't compatible with any of the new @angular/service-worker versions; which it should.

Mention any other details that might be useful.

The old version of @angular/service-worker is working, 1.0.0-beta.16.

2 (required) bufix

Most helpful comment

There is no built-in support for service worker in 1.5. But since the @angular/service-worker package has its cli separate you can use it with 1.5. There is a good explanation for this by @webmaxru here and here. Just make sure to remove the service-worker entry from the .angular-cli.json, because this will cause a fatal error.

All 18 comments

Same issue here

Perhaps this is by design. Using 1.5 CLI and 5.0 @angular/service-worker also reports this error

Just looked at the latest commits and saw that service-worker got pinned @1.0.0-beta.16 for the 1.5.0 release.

A pity. And a fantastic release btw.

Yep, @angular/service-worker support did not make it into Angular CLI v1.5.0.

Also documentation on @angular/service-worker is lacking. Even angular.io doesn't use it yet so no surprises here.

@Splaktar can we expect to see it in a 1.5.x patch release or the plan is to include it in a minor/major cli release?

I'm not an authority on this topic, but https://github.com/angular/angular-cli/issues/8224 seems to indicate that it would be part of 1.6.0. Based on the rapid rate of development on the CLI, I don't think that will be a long wait.

Btw, the OP should probably be updated to a feature request instead of a bug as this was intended. Actually, this issue likely can be closed in favor of #8224.

Likewise #8080.

There is no built-in support for service worker in 1.5. But since the @angular/service-worker package has its cli separate you can use it with 1.5. There is a good explanation for this by @webmaxru here and here. Just make sure to remove the service-worker entry from the .angular-cli.json, because this will cause a fatal error.

the buildin feature of ServiceWorker ist not updated.
To user ServiceWorker:

  1. remove "serviceWorker": true, from .angular-cli.json

  2. add these scripts to your package.json

    "build:prod": "ng build --prod",
    "ngsw-config": "node_modules/.bin/ngsw-config dist src/ngsw-config.json",
    "ngsw-copy": "cp node_modules/@angular/service-worker/ngsw-worker.js dist/",
    "postbuild:prod": "npm run ngsw-config && npm run ngsw-copy"
  1. run npm run build:prod

I now have cli 1.6.0-rc.0 and confirm that without "serviceWorker": true in the .angular-cli.json file DOES resolve the issue.

Hello All ~

I am having the same issue even after trying what @johanchouquet said. I have "serviceWorker": true in my .angular-cli.json file yet I still get this error when trying to build:

The installed version of @angular/service-worker is 5.1.0-beta.2. This version of the CLI
requires the @angular/service-worker version to satisfy >= 1.0.0-beta.5 < 2.0.0. Please upgrade
your service worker version.

Here is my ng -v info:

Angular CLI: 1.6.0-rc.1-930437e
Node: 8.9.1
OS: win32 x64
Angular: 5.1.0-beta.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

@angular/cli: 1.6.0-rc.1-930437e
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.38
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0-rc.1-930437e
@schematics/angular: 0.1.8
typescript: 2.6.2
webpack: 3.8.1

Please let me know if there is anyway around this. Thanks!

If you want to use @angular/service-worker with the Angular CLI <1.6.0, you will have to install the 1.0.0 Beta version of the service worker for now.

So run npm install --save @angular/service-worker@"~1.0.0-beta" then you can keep you "serviceWorker": true config in your .angular-cli.json.

I think there is still an issue with 1.6.0-rc.1.

If you try to use @angular/service-worker in 5.1.0-rc.1 for example, you run into:

The installed version of @angular/service-worker is 5.1.0-rc.1. This version of the CLI
requires the @angular/service-worker version to satisfy >= 1.0.0-beta.5 < 2.0.0. Please upgrade
your service worker version.

whereas using 5.0.5 everything is fine.

Update: looks like the CLI check uses semver.satisfies which will fail for RC and betas. I'm opening a PR to start a discussion on using gt() instead.

works in 1.6.0-rc.2

@dalu this is fixed in the upcoming 1.6
You can try 1.6.0-rc.2 if you want (first release with the fix).

Closing as RC versions of version 1 is no longer supported.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rwillmer picture rwillmer  路  3Comments

NCC1701M picture NCC1701M  路  3Comments

donaldallen picture donaldallen  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments