[英]Build failed with Angular AOT
我正在嘗試使用ionic cordova build android --prod tag
構建一個 Ionic 項目
當我嘗試使用開發或正常構建時,它可以工作。 但是使用prod它會出錯。
這是我的packages.json文件:
{
"name": "chimera",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/admob-free": "4.20.0",
"@ionic-native/call-number": "4.16.0",
"@ionic-native/core": "4.4.0",
"@ionic-native/email-composer": "4.16.0",
"@ionic-native/file-opener": "^4.16.0",
"@ionic-native/in-app-browser": "4.20.0",
"@ionic-native/onesignal": "^4.20.0",
"@ionic-native/social-sharing": "4.16.0",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "4.4.0",
"@ionic/cloud-angular": "0.12.0",
"@ionic/pro": "1.0.16",
"@ionic/storage": "2.1.3",
"@ngx-translate/core": "9.1.1",
"@ngx-translate/http-loader": "3.0.1",
"angular2-masonry": "0.4.0",
"call-number": "1.0.1",
"cordova-admob-sdk": "^0.13.1",
"cordova-android": "6.4.0",
"cordova-ios": "4.5.5",
"cordova-plugin-admob-free": "^0.13.0",
"cordova-plugin-compat": "1.2.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file-opener2": "^2.2.1",
"cordova-plugin-inappbrowser": "^1.7.2",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-socialsharing": "^5.4.7",
"cordova-promise-polyfill": "0.0.2",
"es6-promise-plugin": "^4.2.2",
"ionic-angular": "3.9.2",
"ionic-marquee": "0.4.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"mx.ferreyra.callnumber": "0.0.2",
"ng2-twitter": "0.3.0",
"onesignal-cordova-plugin": "^2.5.0",
"rxjs": "6.3.3",
"rxjs-compat": "6.3.3",
"sw-toolbox": "3.6.0",
"webpack-sources": "1.3.0",
"xml2js": "0.4.19",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.4",
"@ionic/lab": "1.0.2",
"@types/xml2js": "0.4.3",
"typescript": "2.4.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-inappbrowser": {},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+",
"PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.",
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to function properly."
},
"mx.ferreyra.callnumber": {},
"cordova-plugin-admob-free": {
"ADMOB_APP_ID": "ca-app-pub-2899054860592317~3367233553"
},
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"call-number": {},
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"onesignal-cordova-plugin": {}
},
"platforms": [
"android",
"ios"
]
}
}
這是我的env 文件:
Ionic:
Ionic CLI : 5.0.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 8.0.0
Cordova Platforms : android 6.4.0
Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 9 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
ios-deploy : 1.9.4
NodeJS : v8.12.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.3 Build version 10G8
我不知道它在做什么。
得到這個錯誤:
[14:19:12] typescript error
Error during template compile of 'BrowserXhr' Function calls are not supported in decorators but
'makeDecorator' was called in 'Injectable' 'Injectable' references 'Injectable' 'Injectable' references
'Injectable' 'Injectable' references 'Injectable' 'Injectable' calls 'makeDecorator'.
[14:19:12] ionic-app-script task: "build"
[14:19:12] Error: The Angular AoT build failed. See the issues above
Error: The Angular AoT build failed. See the issues above
at /Users/wasiq/Desktop/development/fantaproapp/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55
at step (/Users/wasiq/Desktop/development/fantaproapp/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
at Object.next (/Users/wasiq/Desktop/development/fantaproapp/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
at fulfilled (/Users/wasiq/Desktop/development/fantaproapp/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)
at <anonymous>
[ERROR] An error occurred while running subprocess ionic-app-scripts.
已經嘗試了一些諸如注釋幾行代碼之類的方法,但我不知道是哪個文件導致了該錯誤。 任何幫助將不勝感激。
我有類似的問題嘗試(重新)安裝@ionic/app-scripts@latest
npm --save install @ionic/app-scripts@latest
有時 npm 子模塊未正確保存在節點模塊中。
這為我修復了它: https : //github.com/ionic-team/ionic-app-scripts/issues/1516#issuecomment-482823340
為Borislav Stoilov喝彩
我也有這個問題。 有人修復了嗎?
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.