Could not find an NgModule. Use the skip-import option to skip importing in NgModule
Error recurrence
Create a login component according to the scaffold provided by ng-zorro
ng g ng-zorro-antd:form-normal-login login
For details, click the link to enter the official website and select scaffolding to see the tutorial
Cause of error
Because there are many modules under the project, he doesn’t know where to create them. So a description like the title will appear. So we need to specify where to create it, so that there will be no case that the command does not know where to create it.
Solution
For example, a module is welcome.module.ts . And you want to create one login.module.ts It’s the same level as this module.
|`pages
| |`welcome
| welcome.module.ts
| |`login # This is the following you want to create
| login.module.ts
1. Go to the pages folder
cd pages
2. Use — module = welcome to determine the installation location
ng g ng-zorro-antd:form-normal-login --module=welcome
3. And then there’s a message
? What should be the name of the component? login
4. Prompt information after success
CREATE src/app/pages/login/login.component.css (239 bytes)
CREATE src/app/pages/login/login.component.html (1187 bytes)
CREATE src/app/pages/login/login.component.spec.ts (602 bytes)
CREATE src/app/pages/login/login.component.ts (751 bytes)
UPDATE src/app/pages/welcome/welcome.module.ts (389 bytes)
5. Let’s explain why this can be done successfully.
Step 2 is to specify the location of the component you want to create. That is to say, you – module = are followed by the modules that can be found in the current path. If you can’t find them, you won’t succeed in creating them.
Step 3 asks you to fill in the name of the component you want to create.