如何在 Fedora 上为我的虚拟机 运行 分配更多内存以避免堆内存不足错误
How to allocate more memory to my Virtual Machine running on Fedora to avoid Heap out of Memory Error
我在 Fedora 虚拟机上 运行ning Jenkins,并有一个由 create-react-app 创建的应用程序。
当我尝试在我的本地机器上构建生产环境时,大约 8 分钟后,它确实编译成功(尽管显示消息:'the bundle size is significantly larger than recommended...'
但是,当我在 Jenkins 构建过程中 运行 相同的脚本时,出现以下错误:FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
.
构建脚本如下:npm run build-css && node --max_old_space_size=8192 node_modules/.bin/react-scripts-ts build && npm run copy-to-build
.
我的问题是,如何在 Fedora 上为我的虚拟机 运行ning 分配更多内存,以便脚本可以 运行 在抛出 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
之前成功。
我的解决方案是在 .env.production 文件中设置 GENERATE_SOURCEMAP=false
,如 here 所述。
更好的解决方案(虽然更耗时)是code split 大文件(>1MB)
我在 Fedora 虚拟机上 运行ning Jenkins,并有一个由 create-react-app 创建的应用程序。
当我尝试在我的本地机器上构建生产环境时,大约 8 分钟后,它确实编译成功(尽管显示消息:'the bundle size is significantly larger than recommended...'
但是,当我在 Jenkins 构建过程中 运行 相同的脚本时,出现以下错误:FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
.
构建脚本如下:npm run build-css && node --max_old_space_size=8192 node_modules/.bin/react-scripts-ts build && npm run copy-to-build
.
我的问题是,如何在 Fedora 上为我的虚拟机 运行ning 分配更多内存,以便脚本可以 运行 在抛出 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
之前成功。
我的解决方案是在 .env.production 文件中设置 GENERATE_SOURCEMAP=false
,如 here 所述。
更好的解决方案(虽然更耗时)是code split 大文件(>1MB)