이온 2 프로젝트를 최신 버전 (3.0.0)으로 마이그레이션했습니다. 모든 것이 완벽해질 때까지 오늘 프로젝트에서 새 페이지 (DiscountOption
)를 생성했습니다. 3 대신에 4 개의 파일을 생성했습니다 (* .module.ts는 새로운 파일 임).이온 2 프로젝트를 만들 수 없습니다
할인-option.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { DiscountOption } from './discount-option';
@NgModule({
declarations: [
DiscountOption,
],
imports: [
IonicPageModule.forChild(DiscountOption),
],
exports: [
DiscountOption
]
})
export class DiscountOptionModule { }
app.module.ts
...
import { DiscountOption } from '../pages/orders/biller/discount-option/discount-option';
@NgModule({
declarations: [
...
DiscountOption
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
...
DiscountOption
],
providers: [
...
]
})
export class AppModule { }
(... 코드를 간결 단축)
: 여기 내 코드입니다ionic build android --prod
나는
[11:35:52] ionic-app-script task: "build"
[11:35:52] Error: Type DiscountOption in E:/TFS
SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.ts is part of the
declarations of 2 modules: AppModule in E:/TFS SOURCE/HMS/HMS.App/eKot/src/app/app.module.ts and
DiscountOptionModule in E:/TFS
SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.module.ts! Please consider
moving DiscountOption in E:/TFS
SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.ts to a higher module that
imports AppModule in E:/TFS SOURCE/HMS/HMS.App/eKot/src/app/app.module.ts and DiscountOptionModule in E:/TFS
SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.module.ts. You can also
create a new NgModule that exports and includes DiscountOption in E:/TFS
SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.ts then import that NgModule
in AppModule in E:/TFS SOURCE/HMS/HMS.App/eKot/src/app/app.module.ts and DiscountOptionModule in E:/TFS
SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.module.ts.
Error: Type DiscountOption in E:/TFS SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.ts is part of
the declarations of 2 modules: AppModule in E:/TFS SOURCE/HMS/HMS.App/eKot/src/app/app.module.ts and DiscountOptionModule in E:/T
FS SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.module.ts! Please consider moving DiscountOptio
n in E:/TFS SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.ts to a higher module that imports App
Module in E:/TFS SOURCE/HMS/HMS.App/eKot/src/app/app.module.ts and DiscountOptionModule in E:/TFS SOURCE/HMS/HMS.App/eKot/src/page
s/orders/biller/discount-option/discount-option.module.ts. You can also create a new NgModule that exports and includes DiscountOp
tion in E:/TFS SOURCE/HMS/HMS.App/eKot/src/pages/orders/biller/discount-option/discount-option.ts then import that NgModule in App
Module in E:/TFS SOURCE/HMS/HMS.App/eKot/src/app/app.module.ts and DiscountOptionModule in E:/TFS SOURCE/HMS/HMS.App/eKot/src/page
s/orders/biller/discount-option/discount-option.module.ts.
at Error (native)
at syntaxError (E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler.umd.js:1513:34)
at CompileMetadataResolver._addTypeToModule (E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler.um
d.js:14118:31)
at E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler.umd.js:14007:27
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler
.umd.js:13998:54)
at addNgModule (E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler.umd.js:22526:58)
at E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler.umd.js:22537:14
at Array.forEach (native)
at _createNgModules (E:\TFS SOURCE\HMS\HMS.App\eKot\node_modules\@angular\compiler\bundles\compiler.umd.js:22536:26)
은이 오류로 인해 두 번 app.module에서 모듈 및 새로 생성 된 모듈 파일을 선언하는 것입니다 알고,이 오류가 발생합니다. 어떻게 작동시키는 지 모르겠습니다. 조언이 도움이 될 것입니다. 고맙습니다.
은 여기 내 이온 정보
E입니다 : \ TFS SOURCE \ HMS \ HMS.App \ eKot> 이온 성 정보
시스템 정보 :Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.0
Xcode version: Not installed
응답 해 주셔서 감사합니다. 참조를 제거했으며 프로젝트가 작성되었습니다. 하지만 장치에서 실행하면 페이지가 표시되지 않습니다. 브라우저에서 서비스 할 때 콘솔에 'DiscountOption에 대한 구성 요소 팩터 리 없음'오류가 표시됩니다. @ NgModule.entryComponents에 추가 했습니까? '. 나는 대답과 직접적으로 모순되는 app.module.ts에서 그것을 참조 할 필요가있다! –
app.component.ts에서 페이지를 가져 왔습니까? –
app.component.ts 또는 app.module.ts가 맞습니까? –