简体   繁体   中英

Angular cannot find module to import on ionic

app.module.ts

 import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { RouteReuseStrategy } from '@angular/router'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { Addproduct } from '../addproduct/addproduct' @NgModule({ declarations: [AppComponent, Addproduct], entryComponents: [Addproduct], .. .. .. })

Please see this image

error is this:

 ERROR in src/app/app.module.ts(11,28): error TS2307: Cannot find module '../addproduct/addproduct'.

I am tried a lot of troubleshooting but still got an error. I am using updated ionic version

I think the error is coming because you didn't specify what you are importing properly

Ex: If you are importing a component it should be like this:

import { Addproduct } from '../addproduct/addproduct.component';

If you are importing a page then:

import { Addproduct } from '../addproduct/addproduct.page';

If it is component then

import { addproductComponent } from "../components/addproduct/addproduct";

If it is a page

 import { AddproductPage } from "../pages/addproduct/addproduct";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM