Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
I am not sure
Description
Generating a new component in a library with an invalid library-name result in an irritating error message:
Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
I would expect the same error-message that other commands produce (e.g ng s --project='...'
with invalid project name):
Project '...' does not exist.
Spelling the library correct allows me to generate my component (as expected). The Problem here is the error message. It took me a while to realise the real problem was a spelling mistake in my command.
🔬 Minimal Reproduction
ng new ng-generate-error-message
(no routing, css as stylesheet format)
cd ng-generate-error-message
ng g library my-lib
ng g c new-component --project=my-lib-with-a-typo
The output that i get:
Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
The output that i would expect:
Project 'my-lib-with-a-typo' does not exist.
🔥 Exception or Error
Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 12.0.2
Node: 14.17.0
Package Manager: npm 6.14.13
OS: win32 x64
Angular: 12.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1200.2
@angular-devkit/build-angular 12.0.2
@angular-devkit/core 12.0.2
@angular-devkit/schematics 12.0.2
@schematics/angular 12.0.2
ng-packagr 12.0.2
rxjs 6.6.7
typescript 4.2.4