I am facing this issue, I am unable to generate the component in angular, I tried deleting node-modules, tried uninstalling angular cli, again installed.
Asked
Active
Viewed 133 times
2 Answers
0
Looks like your terminal recognize command differently? I see you have opened files ng,g,c and product-detail - are they opened/created after invoking this command?
Check here btw How to create a new component in Angular 4 using CLI

Eugene Porodko
- 186
- 1
- 7
-
When I hit the command for new components. its get created – Ajay Singh Apr 06 '23 at 13:32
-
well thats not good( make sure your terminal recognize "ng" as an angular cli. try ng help ng generate --help https://angular.io/cli#basic-workflow – Eugene Porodko Apr 06 '23 at 13:34
-
btw how did you install cli? – Eugene Porodko Apr 06 '23 at 13:35
-
npm install @angular/cli – Ajay Singh Apr 06 '23 at 13:39
-
oh try to add flag -g to make it global – Eugene Porodko Apr 06 '23 at 13:39
-
When I run ng help command its generating the help file, when I run the ng generate --help its generating the generate file. – Ajay Singh Apr 06 '23 at 13:40
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/253009/discussion-between-ajay-singh-and-eugene-porodko). – Ajay Singh Apr 06 '23 at 13:42
0
It is possible that you have misconfigured something in the project, if you have not made much progress in the project I recommend the following (because it is not normal for you to have this type of problem)
First of all, sometimes VSC bugs, I close and open and everything is fine. If it does not work:
- Uninstall Angular
- Install Angular
- Remember if the packages are installed (NPM)
- ng generate component product-detail or ng g c product-detail
- Sometimes the solution to complex problems requires trying different ways to solve it, I hope this type of quick solution will help you.
remember: Download the extensions for angular, they will help you a lot. (Tell me how it's going)

Javier Alonso
- 1
- 1