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.
Read More:
- How to Skip testing when Maven is packaged
- ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule
- [Solved] Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables –wait -t na…
- [Solved] Error (suppressible): (vsim-12110) All optimizations are disabled because the -novopt option is in effect…
- Fastplanner compilation error: Could not find a package configuration file provided by “cmake_modules”
- [Solved] Ubuntu pyinstaller Error when packaging executable file: … qt.qpa.plugin: Could not find the Qt platform plugin “xcb“ in “…
- Grep: How to Find All the Files Containing a String in Linux
- [Solved] Go use zoom to connect DM database and start reporting error in Linux
- How to Use Annotations in Flutter & Dart
- Nginx Error: [emerg] bind() to [::]:80 failed (98: Address already in use)
- How to Solve Error: Address already in use
- [Solved] Web server failed to start. Port 8080 was already in use.
- [Solved] Your requirements could not be resolved to an installable set of packages.
- [Solved] Find command error: find: missing “- exec” parameter solution
- [Solved] /usr/bin/ld: cannot find crti.o: No such file or directory & /usr/bin/ld: cannot find -lc
- [Solved] Cannot run program “svn” (in directory “D: xxxx”): CreateProcess error=2, the system cannot find the specified file.
- The upgrade of Ubuntu results in an error in the compilation of Android Jack [Two Method to Solve]
- [Solved] Cannot find command ‘git‘ – do you have ‘git‘ installed and in your PATH?
- How to Use Apt get Command Under Mac OSX
- Error: linker ` link. Exe ` not found | = note: the system cannot find the specified file.