简体   繁体   English

执行命令时出错:node --max_old_space_size=3072 node_modules/@vue/cli-service/bin/vue-cli-service.js build

[英]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.

相关问题 节点 --max_old_space_size 不工作 - node --max_old_space_size is not working 当使用 vue-cli-service build 我得到一个节点错误'Error: write EPIPE' - when use vue-cli-service build i got an node error 'Error: write EPIPE' 从vue-cli应用程序中的node_modules导入js文件 - Import js file from node_modules in vue-cli app 错误:尝试运行 npm 时找不到模块“C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js” - Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' when trying to run npm Vue.js 巨大的 node_modules(初学者问题) - Vue.js vast size of node_modules (Beginner question) 从node_modules将JS导入Vue - Import JS to Vue from node_modules npm ERR:错误:EACCES,权限被拒绝。 访问'/Users/patrikkozak/.npm-global/lib/node_modules/@vue/cli' - npm ERR! Error: EACCES: permission denied, access '/Users/patrikkozak/.npm-global/lib/node_modules/@vue/cli' 错误:找不到模块“C:\Users\senyo\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js” - Error: Cannot find module 'C:\Users\senyo\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js' EACCES:权限被拒绝,打开'/usr/local/lib/node_modules/npm/bin/npm-cli.js' - EACCES: permission denied, open '/usr/local/lib/node_modules/npm/bin/npm-cli.js' 错误:找不到模块 'C:\Users\nguye\AppData\Local\nodejs\node_modules\npm\bin\npm-cli.js' - Error: Cannot find module 'C:\Users\nguye\AppData\Local\nodejs\node_modules\npm\bin\npm-cli.js'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM