Angular-cli: Angular CLI not generating service

Created on 12 Jan 2018  路  5Comments  路  Source: angular/angular-cli

Versions

位 ng --version && echo node: && node --version && echo npm: && npm --version

Angular CLI: 1.6.3
Node: 9.4.0
OS: win32 x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.3
@angular-devkit/build-optimizer: 0.0.37
@angular-devkit/core: 0.0.24
@angular-devkit/schematics: 0.0.43
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.12
typescript: 2.4.2
webpack: 3.10.0
node:
v9.4.0
npm:
5.6.0

Repro steps

  • Step 1
    ng generate service core/example --module=app

Note that it doesn't work with both node LTS and 9.4.0. I also tried with no success reinstalling cli

Observed behavior

位 ng g s core/configuration --module=app
Error: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.

Desired behavior

Mention any other details that might be useful (optional)

Most helpful comment

ensure @angular-devkit/schematics is at the latest version (currently: 0.0.45). This was fixed in that version.

All 5 comments

Workaround.
Install angular cli 1.5.5.

Correction:

This is not related to angular-cli itself. The problem is a dependency issue.

After downgrading angular cli from 1.6.3 to 1.5.5 everything worked fine, however, the root cause is:

When installing angular-cli 1.6.3 npm displays the warning message:

npm WARN @schematics/[email protected] requires a peer of @angular-devkit/[email protected] but none is installed. You must install peer dependencies yourself.

After installing @angular-devkit/[email protected] it will no longer be possible to generate service using cli (at least what is applicable for me)

So the correct workaround is to remove the extra dev dependency @angular-devkit/[email protected] and re install angular-cli; but not sure of the side effects.

ensure @angular-devkit/schematics is at the latest version (currently: 0.0.45). This was fixed in that version.

you right 0.0.45 is much better but it doesn't solve the warn (which is to me misleading and to a certain extent is the root cause of this).
npm WARN @schematics/[email protected] requires a peer of @angular-devkit/[email protected]

That is actually a packaging issue. The peer dependency version was erroneously not updated during the process. This is being tracked internally and will be corrected in the next release of the package.

Closing this issue as resolved. Please re-open, if needed.

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

donaldallen picture donaldallen  路  3Comments

purushottamjha picture purushottamjha  路  3Comments

hareeshav picture hareeshav  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments