当前位置: 首页 > 知识库问答 >
问题:

使用节点生成“ng Build”-Angular应用程序时内存不足

司徒翼
2023-03-14

我正在尝试使用“ng build”构建我的angular应用程序。它之所以失败,是因为根据我的研究推测,它的内存不足,无法构建。我尝试过几种解决方案,但都没有成功。从VSC终端或在DOS线路上键入“ng build”后,它将在此步骤中运行约3分钟:

Generating ES5 bundles for differential loading...

然后它会失败,并将此错误写入我的angular-errors.log文件:

[error] Error: Call retries were exceeded
    at ChildProcessWorker.initialize (c:\development\gems\Frontend_Serenity_A9_SLIM\Frontend_Serenity_A9\node_modules\jest-worker\build\workers\ChildProcessWorker.js:193:21)
    at ChildProcessWorker.onExit (c:\development\gems\Frontend_Serenity_A9_SLIM\Frontend_Serenity_A9\node_modules\jest-worker\build\workers\ChildProcessWorker.js:263:12)
    at ChildProcess.emit (events.js:203:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

正如一些文章/堆栈溢出所指出的那样,我试图增加我的内存。我试过这个:

npm install -g increase-memory-limit

然后在angular项目的根目录下运行此命令:

increase-memory-limit

无济于事。使用es5而不是es2015不是我们应用程序的解决方案。非常感谢您提供的任何帮助或想法。我已经尝试了一周的所有方法,但仍然卡住了。谢谢!

package.json内容:

{
  "name": "serenity",
  "version": "9.0.0",
  "license": "PrimeNG Commercial",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "9.0.4",
    "@angular/cdk": "9.1.0",
    "@angular/common": "9.0.4",
    "@angular/compiler": "9.0.4",
    "@angular/core": "9.0.4",
    "@angular/forms": "9.0.4",
    "@angular/material": "^9.1.0",
    "@angular/platform-browser": "9.0.4",
    "@angular/platform-browser-dynamic": "9.0.4",
    "@angular/router": "9.0.4",
    "@aspnet/signalr": "^1.1.4",
    "@fullcalendar/core": "4.0.2",
    "@fullcalendar/daygrid": "4.0.1",
    "@fullcalendar/interaction": "4.0.2",
    "@fullcalendar/timegrid": "4.0.1",
    "@handsontable/angular": "^5.1.1",
    "@mdi/svg": "^5.3.45",
    "@types/leaflet-draw": "^1.0.2",
    "@types/plotly.js": "^1.50.12",
    "chart.js": "2.7.3",
    "d3": "^5.16.0",
    "font-awesome": "4.7.0",
    "handsontable": "^7.4.2",
    "intl": "1.2.5",
    "leaflet": "^1.6.0",
    "leaflet-draw": "^1.0.4",
    "leaflet-sidebar-v2": "^3.2.2",
    "leaflet.control.layers.tree": "^1.0.0",
    "leaflet.glify": "^3.0.0",
    "material-design-icons": "^3.0.1",
    "plotly.js-dist": "^1.54.1",
    "primeflex": "1.0.0",
    "primeng": "9.0.1",
    "prismjs": "1.15.0",
    "quill": "1.1.8",
    "rxjs": "6.5.4",
    "three": "^0.117.1",
    "web-animations-js": "github:angular/web-animations-js#release_pr208",
    "html" target="_blank">xlsx": "^0.16.2",
    "zone.js": "0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.900.4",
    "@angular/cli": "9.0.4",
    "@angular/compiler-cli": "9.0.4",
    "@angular/language-service": "9.0.4",
    "@types/jasmine": "3.5.7",
    "@types/jasminewd2": "2.0.8",
    "@types/leaflet": "^1.5.17",
    "@types/node": "12.12.29",
    "codelyzer": "5.2.1",
    "jasmine-core": "3.5.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "4.3.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-coverage-istanbul-reporter": "2.1.1",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.5.2",
    "protractor": "5.4.3",
    "ts-node": "8.3.0",
    "tslint": "5.18.0",
    "typescript": "3.7.5"
  }
}

共有2个答案

钦宏义
2023-03-14

是的,这是一个内存问题,我很难让节点在构建我的项目之前更改内存限制。我能够让它分配3场演出,然后它工作得很好。

宓诚
2023-03-14

请注意,如果这对您的情况有帮助,请确定,但是您是否尝试过在“角度”中的“配置”下的“预算”部分中增加maximumError。json文件?

 类似资料:
  • 当我在project meteor文件夹中运行节点时,得到的结果就是这样。 我的版本是。我的流星版本是。 /home/getfeliz/iis/bundle/programs/server/node_modules/fibers/future.js:280 throw(ex);^TypeError:undefined不是runWebAppServer(Packages/webapp/webapp_

  • 在Windows 10主页(在x64位)上,我尝试在命令提示符上运行以下命令: 节点索引。js 错误如下: C:\Users\cooldudeasateen\OneDrive\Coding\sil\node\u modules\bindings\bindings。js:121;e^ 错误:\?\C:\Users\cooldudeasateen\OneDrive\Coding\sil\node\u

  • 通过应用生成器工具 express-generator 可以快速创建一个应用的骨架。 你可以通过 npx (包含在 Node.js 8.2.0 及更高版本中)命令来运行 Express 应用程序生成器。 $ npx express-generator 对于较老的 Node 版本,请通过 npm 将 Express 应用程序生成器安装到全局环境中并执行即可。 $ npm install -g ex

  • 我有一个TypeScript应用程序。我想将node_modules内的依赖项捆绑到生成的捆绑包中。这是我迄今为止根据这些帖子尝试的内容(是否汇总捆绑包node_modulesbundle.js?,是否汇总捆绑包node_modulesbundle.js?)。 以下是我的汇总配置和我尝试绑定的简单文件: 文件: 使用汇总打字稿时,如何在node_modules中获取依赖项以捆绑到最终输出中?我怀疑