question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error with generating new component by angular-cli

See original GitHub issue

Trying generate new angular component by follow command: $ ng g c sidebar I got error message: Error: Could not find an NgModule for the new component. Use the skip-import option to skip importing components in NgModule. Could not find an NgModule for the new component. Use the skip-import option to skip importing components in NgModule.

When I try generate new component without import ( -skip-import option) new component added with wrong path: $ ng g c sidebar -skip-import create src/main/webapp/src/main/webapp/app/sidebar/sidebar.component.html (26 bytes) create src/main/webapp/src/main/webapp/app/sidebar/sidebar.component.ts (245 bytes)

JHipster Version(s)
demoissue@0.0.0 JHIPSTER-projects\demoissue
`-- generator-jhipster@4.10.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
                                                                                                                        
{                                                                                                                            
  "generator-jhipster": {                                                                                                    
    "promptValues": {                                                                                                        
      "packageName": "com.fiveplus.cosmo"                                                                                    
    },                                                                                                                       
    "jhipsterVersion": "4.10.0",                                                                                             
    "baseName": "demoissue",                                                                                                 
    "packageName": "com.fiveplus.cosmo",                                                                                     
    "packageFolder": "com/fiveplus/cosmo",                                                                                   
    "serverPort": "8080",                                                                                                    
    "authenticationType": "jwt",                                                                                             
    "hibernateCache": "ehcache",                                                                                             
    "clusteredHttpSession": false,                                                                                           
    "websocket": false,                                                                                                      
    "databaseType": "sql",                                                                                                   
    "devDatabaseType": "postgresql",                                                                                         
    "prodDatabaseType": "postgresql",                                                                                        
    "searchEngine": false,                                                                                                   
    "messageBroker": false,                                                                                                  
    "serviceDiscoveryType": false,                                                                                           
    "buildTool": "maven",                                                                                                    
    "enableSocialSignIn": false,                                                                                             
    "enableSwaggerCodegen": false,                                                                                           
    "jwtSecretKey": "replaced-by-jhipster-info",                                                                             
    "clientFramework": "angularX",                                                                                           
    "useSass": false,                                                                                                        
    "clientPackageManager": "yarn",                                                                                          
    "applicationType": "monolith",                                                                                           
    "testFrameworks": [],                                                                                                    
    "jhiPrefix": "jhi",                                                                                                      
    "enableTranslation": false                                                                                               
  }                                                                                                                          
}                                                                                                                            
##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**
JDL entity definitions
                                                                                                                        
##### **Environment and Tools**

java version “1.8.0_101”
Java™ SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot™ 64-Bit Server VM (build 25.101-b13, mixed mode)

git version 2.13.0.windows.1

node: v6.11.3

npm: 5.4.2

bower: 1.8.0

yeoman: 2.0.0

yarn: 1.0.2

Browsers and Operating System

OS: windows 7

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

27reactions
ved1995commented, Jun 10, 2018

If you are working in your current project directory, just change it to /src/app and then run the command ‘ng g c your-component’ and your component will be generated. It worked for me.

5reactions
jduboiscommented, Oct 20, 2017

It looks you are not in the right directory -> in which directory do you run those commands?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 4 Generate Component error - Stack Overflow
I am trying to create new Component using angular CLI. command : ng generate component myFolder/newComponent But I am getting below error: Error...
Read more >
ng generate error · Issue #10653 · angular/angular-cli - GitHub
Just generated a new angular 6 project and tried to generate a module or a component and had the same issue, i`m using...
Read more >
Creating libraries - Angular
This page provides a conceptual overview of how to create and publish new libraries to extend Angular functionality. If you find that you...
Read more >
Identify and Fix Build and Deployment Errors in Your Angular ...
Once you have verified that you have installed the Angular CLI globally on your machine and that you are in the proper directory,...
Read more >
7. Creating New Component with the angular CLI ... - YouTube
7. Creating New Component with the angular CLI Command Generate Component & Nesting Components.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found