![](/img/trans.png)
[英]FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory in Ionic 3
[英]Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory Ionic 3 prod build
在构建 Ionic 3 应用程序的产品版本时出现以下错误。 “ FATAL ERROR: In Effective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory “为了重现这个问题,我制作了整个项目的副本并在复制的项目中进行了 prod 构建,但令人惊讶的是生成了 prod 构建。 我无法找到导致此问题的确切原因。
我附上我的 package.json
{
"name": "Fusion",
"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/animations": "^5.0.0",
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/compiler-cli": "5.0.0",
"@angular/core": "5.0.0",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@ionic-native/camera": "^4.20.0",
"@ionic-native/core": "4.3.2",
"@ionic-native/file": "^4.20.0",
"@ionic-native/file-path": "^4.20.0",
"@ionic-native/file-transfer": "^4.20.0",
"@ionic-native/local-notifications": "^4.20.0",
"@ionic-native/onesignal": "^4.20.0",
"@ionic-native/qr-scanner": "^4.20.0",
"@ionic-native/spinner-dialog": "^4.20.0",
"@ionic-native/splash-screen": "4.3.2",
"@ionic-native/sqlite": "^4.20.0",
"@ionic-native/status-bar": "4.3.2",
"@ionic-native/toast": "^4.20.0",
"@ionic-native/transfer": "^3.14.0",
"@ionic/storage": "^2.2.0",
"@types/jquery": "^3.3.32",
"buffer": "^5.2.1",
"chart.js": "^2.7.3",
"cldr-data": "^36.0.0",
"concat-stream": "^1.6.2",
"cordova-android": "^8.1.0",
"cordova-browser": "5.0.4",
"cordova-plugin-badge": "0.8.8",
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "1.7.1",
"cordova-plugin-ionic-webview": "^4.2.1",
"cordova-plugin-local-notification": "0.9.0-beta.2",
"cordova-plugin-native-spinner": "^1.1.3",
"cordova-plugin-qrscanner": "^3.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-toast": "^2.7.2",
"cordova-sqlite-storage": "^5.0.0",
"core-js": "^2.5.7",
"crypto-js": "^3.1.9-1",
"devextreme": "19.1.10",
"devextreme-angular": "19.1.10",
"events": "^3.0.0",
"globalize": "^1.4.2",
"hammerjs": "^2.0.8",
"iana-tz-data": "^2019.1.0",
"ionic-angular": "3.9.2",
"ionic-select-searchable": "^2.10.0",
"ionic-selectable": "^3.4.0",
"ionicons": "3.0.0",
"jquery": "^3.3.1",
"jszip": "^3.1.5",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"ngx-soap": "^0.5.0-beta.7",
"node-sass": "^4.14.1",
"onesignal-cordova-plugin": "^2.8.4",
"primeicons": "^1.0.0",
"primeng": "^5.2.7",
"rxjs": "5.5.2",
"sax": "^1.2.4",
"stream": "0.0.2",
"sw-toolbox": "3.6.0",
"tracking": "^1.1.3",
"uuid": "^3.3.2",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.1",
"@ionic/cli-plugin-cordova": "1.6.2",
"@ionic/cli-plugin-ionic-angular": "1.4.1",
"@types/jasmine": "^2.8.6",
"@types/jasminewd2": "^2.0.3",
"@types/node": "^13.13.4",
"typescript": "^2.7.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-file": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-camera": {},
"cordova-plugin-file-transfer": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-qrscanner": {},
"cordova-sqlite-storage": {},
"cordova-plugin-native-spinner": {},
"cordova-plugin-x-toast": {}
},
"platforms": [
"android"
]
}
}
我在我的项目中经常遇到这个问题,但在复制的项目中却没有。 这两个项目具有相同的 package.json 和代码。
当您的应用程序消耗的 memory 比默认分配的多时,就会发生这种情况。 你可以做两件事
node --max_old_space_size=8192 $which(ionic-app-scripts) build
或node --max-old-space-size=8192./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build
增加堆 memory 分配node --max-old-space-size=8192./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build
并且对于它在复制项目中起作用的点 - 可能是您的系统资源在那个时间点不是那么忙
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.