agent-Specialization/.astrion/memory/server_frontend_build_oom.md

28 lines
899 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: server_frontend_build_oom
description: 当服务器执行前端构建失败、OOM、或需要部署前端时应该索引本记忆
---
# 服务器前端构建 OOM
## 问题
服务器2G 内存 Linux执行 `npm run build` 时因内存不足导致 OOM进程被 kill服务器可能 SSH 超时无响应。
## 解决方案
**不在服务器上构建前端。** 在本地macOS充足内存构建然后 scp 上传 `static/dist/`
## 操作步骤
```bash
# 本地构建
cd agents && npm run build
# 打包上传
tar czf /tmp/static_dist.tar.gz static/dist/
scp /tmp/static_dist.tar.gz root@59.110.19.30:/tmp/
ssh root@59.110.19.30 "cd /opt/agent/agents && tar xzf /tmp/static_dist.tar.gz"
```
## 已落实到脚本
- `deploy_agents.sh`(本地):自动本地 build + 上传
- `refresh_agents.sh`(服务器):已移除 npm build 步骤,注释说明原因