Skip to content

Can't use ng CLI to genereate a component in a library project #10674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eyalellenbogen opened this issue May 6, 2018 · 3 comments
Closed

Can't use ng CLI to genereate a component in a library project #10674

eyalellenbogen opened this issue May 6, 2018 · 3 comments

Comments

@eyalellenbogen
Copy link

Versions

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

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.0
@angular-devkit/build-angular      0.6.0
@angular-devkit/build-ng-packagr   0.6.0
@angular-devkit/build-optimizer    0.6.0
@angular-devkit/core               0.6.0
@angular-devkit/schematics         0.6.0
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.0
@schematics/angular                0.6.0
@schematics/update                 0.6.0
ng-packagr                         3.0.0-rc.2
rxjs                               6.1.0
typescript                         2.7.2
webpack                            4.6.0

Repro steps

  • Start a new app - ng new myApp
  • From the new app's folder add a library project - ng g library someLib
  • From the library folder - ng g c subComp

Observed behavior

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

Desired behavior

I would expect it to generate a component and register it in the main library module just like it does with a new application.

I couldn't find anything in the docs explaining if this is the right approach (I guess this is another issue). Is this by design?

@matheusdavidson
Copy link

matheusdavidson commented May 6, 2018

Same here, its a bug:
#10653 #10672

@Brocco
Copy link
Contributor

Brocco commented May 8, 2018

Closing...
Duplicate of #10653

@Brocco Brocco closed this as completed May 8, 2018
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants