Skip to content

ng generate component create only typescript file #12747

@emiliogambone

Description

@emiliogambone

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
- [x] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 6.0.1
Node: 8.11.1
OS: darwin x64
Angular: 6.0.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.1
@angular/cli                      6.0.1
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              6.3.3
typescript                        2.7.2
webpack                           4.8.3

Repro steps

ng generate component example
ng generate component example --module app
ng generate component example --project test

The log given by the failure

Could not find an NgModule. Use the skip-import option to skip importing in NgModule.

More than one module matches. Use skip-import option to skip importing the component into the closest module.

Or create the component but only the .ts file

Desired functionality

create all the component files

Mention any other details that might be useful

I tried also with angular cli version 6.0.8 but same issue

Here you can find a minimal repro:

https://github.com/emiliogambone/sampleAngular

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions