android - Not able to build Ionic 2 project -
i migrated ionic 2 project latest version (i.e, 3.0.0). perfect until, generated new page (discountoption
) in project today. generated 4 files instead of 3 (*.module.ts new one).
here code:
discount-option.module.ts
import { ngmodule } '@angular/core'; import { ionicpagemodule } 'ionic-angular'; import { discountoption } './discount-option'; @ngmodule({ declarations: [ discountoption, ], imports: [ ionicpagemodule.forchild(discountoption), ], exports: [ discountoption ] }) export class discountoptionmodule { }
app.module.ts
... import { discountoption } '../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 { }
(... code shortened brevity)
when tried build app using ionic build android --prod
i error,
[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 part of declarations of 2 modules: appmodule in e:/tfs source/hms/hms.app/ekot/src/app/app.module.ts , 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 higher module imports appmodule in e:/tfs source/hms/hms.app/ekot/src/app/app.module.ts , discountoptionmodule in e:/tfs source/hms/hms.app/ekot/src/pages/orders/biller/discount-option/discount-option.module.ts. can create new ngmodule exports , includes discountoption in e:/tfs source/hms/hms.app/ekot/src/pages/orders/biller/discount-option/discount-option.ts import ngmodule in appmodule in e:/tfs source/hms/hms.app/ekot/src/app/app.module.ts , 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 part of declarations of 2 modules: appmodule in e:/tfs source/hms/hms.app/ekot/src/app/app.module.ts , 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 higher module imports app module in e:/tfs source/hms/hms.app/ekot/src/app/app.module.ts , discountoptionmodule in e:/tfs source/hms/hms.app/ekot/src/page s/orders/biller/discount-option/discount-option.module.ts. can create new ngmodule exports , includes discountop tion in e:/tfs source/hms/hms.app/ekot/src/pages/orders/biller/discount-option/discount-option.ts import ngmodule in app module in e:/tfs source/hms/hms.app/ekot/src/app/app.module.ts , discountoptionmodule in e:/tfs source/hms/hms.app/ekot/src/page s/orders/biller/discount-option/discount-option.module.ts. @ error (native) @ syntaxerror (e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler.umd.js:1513:34) @ compilemetadataresolver._addtypetomodule (e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler.um d.js:14118:31) @ e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler.umd.js:14007:27 @ array.foreach (native) @ compilemetadataresolver.getngmodulemetadata (e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler .umd.js:13998:54) @ addngmodule (e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler.umd.js:22526:58) @ e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler.umd.js:22537:14 @ array.foreach (native) @ _createngmodules (e:\tfs source\hms\hms.app\ekot\node_modules\@angular\compiler\bundles\compiler.umd.js:22536:26)
i know error due declaring module twice in app.module , newly generated module file. don't know how make work. advice helpful. thank you.
here ionic info
e:\tfs source\hms\hms.app\ekot>ionic info
your system information:
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
check google docs regarding ionic v3.
remove reference discountoption
page app.module.ts.
@ngmodule({ declarations: [ ... ], imports: [ browsermodule, httpmodule, ionicmodule.forroot(myapp), ionicstoragemodule.forroot() ], bootstrap: [ionicapp], entrycomponents: [ ... ], providers: [ ... ] }) export class appmodule { }
your page referenced , declared in page.module.ts
if importing page anywhere else remove it.. use string equivalent of class name.also add @ionicpage()
in discountoption
@ionicpage() @component({ templateurl: 'discount-option.html' }) export class discountoption {}
reference:ionicpage
Comments
Post a Comment