我正在使用Ionic为
Android构建,我总是收到此错误:
离子信息我有这个:
毫无疑问,我浏览了整个互联网寻找解决方案,但我没有成功.
我看过并阅读了以下内容:
> Ionic CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory while starting new project
> Ionic3 android build command not working – FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory
> Ionic3 – FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory
我还观察到,与其他人相比,我有这个独特的错误:
Security context: 000001F502E3FA99 <JS Object>
1: createLiteral [..]
2: typeToTypeNodeHelper(aka typeToTypeNodeHelper) [..]
我已经被困了2天以上,我真的需要帮助和指导.
这是我的package.json内容:
{
"name": "project",
"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.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"@angular/core": "5.2.10",
"@angular/forms": "5.2.10",
"@angular/http": "5.2.10",
"@angular/platform-browser": "5.2.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@ionic-native/camera": "^4.5.2",
"@ionic-native/core": "4.4.0",
"@ionic-native/file": "^4.7.0",
"@ionic-native/file-chooser": "^4.7.0",
"@ionic-native/file-path": "^4.7.0",
"@ionic-native/geolocation": "^4.7.0",
"@ionic-native/onesignal": "^4.5.2",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "4.4.0",
"@ionic-native/twitter-connect": "^4.5.2",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.6",
"cordova-android": "^7.0.0",
"cordova-browser": "~5.0.3",
"cordova-ios": "4.5.4",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-filechooser": "^1.0.1",
"cordova-plugin-filepath": "^1.3.0",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-ionic-webview": "^1.2.0",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"firebase": "^4.12.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"jssha": "^1.6.2",
"moment": "^2.20.1",
"onesignal-cordova-plugin": "^2.2.5",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"twitter-connect-plugin": "git+https://github.com/chroa/twitter-connect-plugin.git",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.7.3",
"@angular-devkit/build-optimizer": "^0.5.7",
"@ionic/app-scripts": "^3.1.8",
"@types/jssha": "0.0.29",
"typescript": "^2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-inappbrowser": {},
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-filechooser": {},
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
},
"twitter-connect-plugin": {
"FABRIC_KEY": "XXXXXXXXXX",
"TWITTER_KEY": "YYYYYYYYY",
"TWITTER_SECRET": "ZZZZZZZZZZZZZZZ"
},
"cordova-plugin-statusbar": {},
"cordova-plugin-filepath": {},
"cordova-plugin-file": {},
"cordova-plugin-geolocation": {}
},
"platforms": [
"ios",
"browser",
"android"
]
},
"main": "index.js",
"license": "ISC"
}
编辑:
我根据@Suraj Rao的建议更新了我的npm,我的版本是6.0.0作为当前版本,然后我再次尝试构建,我得到了这个new related error
最佳答案 我观察到一些问题是依赖性不兼容(某些依赖关系需要特定版本才能工作),但最重要的是 – 使用离子cordova构建语法.这个构建选项是排序的噩梦.我停留了7个多小时没有终止.如果没有此选项,则意味着在需要AOT时使用角度编译器构建.经过大量的浏览和阅读后,我能够在没有–prod的情况下构建,但仍然使用AOT通过此命令离开cordova运行android –aot true –environmen
t prod –output-hashing all –sourcemaps false –extract-css true –named-chunks
false –build-optimizer true检查它
here.虽然不确定它是否正确,但我得到了我想要的结果.