在我的项目中,我使用 Angular6 作为前端。现在我要做的是将远程服务器中的项目部署到实际服务器中。我正在使用 npm run build -prod
命令首先构建前端。但是我无法构建我的项目,因为一次又一次发生以下错误,
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Trackit-Revamp@6.0.0 build: `ng build --prod --build-optimizer --aot`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the Trackit-Revamp@6.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Indrajith.E\AppData\Roaming\npm-cache_logs\2019-08-22T08_41_00_271Z-debug.log
我在 C:\Users\Indrajith.E\AppData\Roaming\npm-cache_logs\2019-08-22T08_41_00_271Z-debug.log
文件路径中的错误日志包含上述相同的错误详细信息。
我该如何解决这个问题?
原文由 INDRAJITH EKANAYAKE 发布,翻译遵循 CC BY-SA 4.0 许可协议
最后,我在不重新安装 npm 的情况下找到了解决此问题的方法,并且我将其发布,因为将来它会帮助某人,大多数情况下会发生此错误,javascript heap out of the memory。正如错误所说,这不是 npm 的问题。我们唯一要做的就是
代替,
通过以下方式扩展 javascript 内存,