首页 > 解决方案 > 运行 ng build 导致错误:无法创建长度超过 0x3fffffe7 个字符的字符串

问题描述

卡住了,需要别人的帮助!

构建 Angular 7 应用程序时遇到问题。在我的应用程序中添加了以下模块:

npm install @stomp/stompjs@5.4.4
npm install sockjs-client@1.4.0

现在执行 ng build 时出现以下错误,如下所示:

[myApp-4.0]$ ng build --prod --base-href=/myApp/ --deploy-url=/myApp/

无法在 Object.fileBufferToString (/my_app/) 的 Buffer.toString (buffer.js:667:10) 处创建长度超过 0x3fffffe7 个字符的字符串myApp/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.js:37:40) 在 MapSubscriber._host.read.pipe.operators_1.map.buffer [as项目] (/my_app/myApp/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/workspace/workspace.js:220:116) 在 MapSubscriber._next (/my_app/myApp/node_modules/@angular /cli/node_modules/rxjs/internal/operators/map.js:49:35) 在 MapSubscriber.Subscriber.next (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67: 18) 在 Observable.rxjs_1.Observable。obs [as _subscribe] (/my_app/myApp/node_modules/@angular/cli/node_modules/@angular-devkit/core/node/host.js:172:21) 在 Observable._trySubscribe (/my_app/myApp/node_modules/@ angular/cli/node_modules/rxjs/internal/Observable.js:44:25) 在 Observable.subscribe (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:30:22) 在MapOperator.call (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/operators/map.js:32:23) 在 Observable.subscribe (/my_app/myApp/node_modules/@angular/cli/node_modules /rxjs/internal/Observable.js:25:22) 在 MapOperator.call (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/operators/map.js:32:23) 在 Observable.subscribe (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:25:22) 在 /my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeTo.js:22:31 在 Object.subscribeToResult (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs /internal/util/subscribeToResult.js:10:45) 在 MergeMapSubscriber._innerSub (/my_app/myApp/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:82:29)

任何帮助将不胜感激。

标签: angularbuildnpm-install

解决方案


尝试增加节点内存大小节点示例“--max_old_space_size=4096”,而不是 4096,您可以放置​​您喜欢的大小(支持 PC),您也可以查看此链接 链接


推荐阅读