angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng generate component return error

Open HarryVu176 opened this issue 1 year ago • 1 comments

Command

generate

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Hi, last week I was using ng generate and there wasn't any problems.

Today, when I'm running ng g c [component_name] I got this error: "Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule."

So I tried to run this ng g c --standalone [component_name] It generates successfully, however the component now coming with suffixes.

Minimal Reproduction

Run: ng g c [component_name] Error: "Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule."

ng g c --standalone [component_name] It generates successfully, however the component now coming with suffixes.

Exception or Error


Your Environment

Angular CLI: 20.3.3
Node: 22.19.0
Package Manager: npm 11.1.0
OS: win32 x64


Angular: 20.2.4
... common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2002.2
@angular-devkit/core         20.2.2
@angular-devkit/schematics   20.3.3
@angular/build               20.2.2
@angular/cdk                 20.2.2
@angular/cli                 20.3.3
@angular/material            20.2.2
@schematics/angular          20.3.3
rxjs                         7.8.2
typescript                   5.9.2

Anything else relevant?

No response

HarryVu176 avatar Oct 01 '25 20:10 HarryVu176

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.