[英]Error while executing command: node --max_old_space_size=3072 node_modules/@vue/cli-service/bin/vue-cli-service.js build
I some projects in AWS codeBuild, the problem i have is that since yesterday i have been getting this error in the build我在 AWS codeBuild 中有一些项目,我遇到的问题是从昨天开始我在构建中遇到了这个错误
[Container] 2020/03/09 12:51:00 Running command node --max_old_space_size=3072 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode production
- Building for production...
Killed
[Container] 2020/03/09 12:53:29 Command did not exit successfully node --max_old_space_size=3072 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode production exit status 137
[Container] 2020/03/09 12:53:29 Phase complete: BUILD State: FAILED
[Container] 2020/03/09 12:53:29 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: node --max_old_space_size=3072 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode production. Reason: exit status 137
I know the probably the project is trying to use more than 3072Mb of ram, but i don't know why, i have another project that have more pages and components and it have not throw that error.我知道该项目可能正在尝试使用超过 3072Mb 的内存,但我不知道为什么,我有另一个项目有更多页面和组件,但它没有抛出该错误。
So here the questions所以这里的问题
How can i know how much ram is using the node to build the vue project in local?我怎么知道有多少内存使用节点在本地构建 vue 项目? How can i optimize the build process?
如何优化构建过程? The node modules has to do with this?
节点模块与此有关吗? this project with the error has more packages than the other one.
这个有错误的项目比另一个项目有更多的包。
A few webpages such as following suggest that it is probably a RAM issue.一些网页(例如以下内容)表明这可能是 RAM 问题。
The node command in the error message has the —- max-old-space-size flag which sets the memory limit to 3gb rather than the default of 512 mb.错误消息中的节点命令具有 ---max-old-space-size 标志,它将内存限制设置为 3gb 而不是默认的 512 mb。
This 3gb value should match the compute type the build project:这个 3gb 值应该与构建项目的计算类型匹配:
You maybe using 'build.general1.small' which has 3gb but node may not be able to allocate all of it.您可能使用 'build.general1.small' 它有 3gb 但节点可能无法分配所有它。
So can you try the command with a lesser amount of memory reading, eg那么您可以尝试使用较少内存读取的命令,例如
$ node --max_old_space_size=2560 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode production
Or you can try to upgrade the compute type but that may incur a price increase.或者您可以尝试升级计算类型,但这可能会导致价格上涨。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.