I have been trying to generate new components using Angular2's CLI tool using this command:
ng generate component test
After execution, new component files are generated, but the references are not added into the app.module.ts file:
No app module found. Please add your new class to your component.
I was trying to find the solution to fix this so I dont have to always import new component and add it to declarations manually, but I couldn't find anything about this issue online.
I think it may have something to do with my angular-cli.json file, but it seems to be ok:
Any ideas?
UPDATE: This is my project folder structure, simplyfied. I removed folders which are not relevant:
Code in the app.module.ts is following:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { SearchComponent } from './search/search.component';
@
NgModule({
declarations: [
AppComponent,
SearchComponent
],
imports: [
BrowserModule,
HttpModule
],
providers: [
],
bootstrap: [
AppComponent
]
})
export class AppModule { }


C:\Sourcessomething here seems off. you generate a component namedtestbut it places it insrc/app/searcheven through that doesn't show at all.