Skip to content

ng generate incorrectly adds component to a module #10030

Closed

Description

@DanielKucal

Versions

Angular CLI: 1.7.2
Node: 7.7.4
OS: darwin x64
Angular: 5.2.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.2
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.1
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

Repro steps

Observed behavior

Angular CLI misplaces component declaration, produces e.g.:

  declarations: [
    AppComponen,
    HomeComponentt,
  ],

Desired behavior

I would expect:

  declarations: [
    AppComponent,
    HomeComponent,
  ],

Mention any other details that might be useful (optional)

  • --lint-fix doesn't matter here
  • directory ("components/") doesn't matter as well

Activity

  1. worthy7 commented on Mar 26, 2018

    @worthy7

    Bumb, kind of critical.

  2. mbtaCode commented on Apr 18, 2018

    @mbtaCode

    Hi! Did you find a solution to this issue? I'm also experiencing the same thing when I create a component from the CLI, except it is moving the last 2 characters. I'm using VS 2017 as my IDE.

    Thanks,
    Mel

  3. worthy7 commented on Apr 19, 2018

    @worthy7

    @mbtaCode Yea It's fixed in the later versions

  4. mbtaCode commented on Apr 20, 2018

    @mbtaCode

    @worthy7 I'm using the latest versions but still seeing the problem. I checked to make sure I'm using the latest CLI globally and this is what came up. Note: I'm on Windows platform.

    C:\Program Files\nodejs>npm list -global --depth 0
    C:\Users\XXXX\AppData\Roaming\npm
    +-- @angular/cli@1.7.4
    `-- npm@5.8.0

  5. DanielKucal commented on Apr 20, 2018

    @DanielKucal
    Author

    @mbtaCode, maybe you have different version of @angular/cli installed locally in the project?

  6. mbtaCode commented on Apr 20, 2018

    @mbtaCode

    @DanielKucal I ran ng v in my angular CLI project folder and the output is:

    Angular CLI: 1.7.4
    Node: 9.2.0
    OS: win32 x64
    Angular: 5.2.10
    ... animations, common, compiler, compiler-cli, core, forms
    ... http, language-service, platform-browser
    ... platform-browser-dynamic, router

    @angular/cli: 1.7.4
    @angular-devkit/build-optimizer: 0.3.2
    @angular-devkit/core: 0.3.2
    @angular-devkit/schematics: 0.3.2
    @ngtools/json-schema: 1.2.0
    @ngtools/webpack: 1.10.2
    @schematics/angular: 0.3.2
    @schematics/package-update: 0.3.2
    typescript: 2.5.3
    webpack: 3.11.0

  7. DanielKucal commented on May 2, 2018

    @DanielKucal
    Author

    @mbtaCode, I just checked it with the newest version and the bug is still present for me too.

  8. worthy7 commented on Jun 1, 2018

    @worthy7

    This is fixed btw.

  9. mbtaCode commented on Jun 1, 2018

    @mbtaCode

    @worthy7 Thanks for letting me know. I haven't seen the issue reappear for a while. It does seem to be fixed.

  10. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    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.

  11. locked and limited conversation to collaborators on Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions