#!/bin/bash # 在服务器上手动执行的命令 # 1. 配置pnpm使用国内镜像 pnpm config set registry https://registry.npmmirror.com # 2. 进入部署目录 cd /var/www/chinese-family-tree # 3. 清理之前失败的安装 rm -rf node_modules rm -rf .next # 4. 安装生产依赖 pnpm install --prod # 5. 生成Prisma客户端 npx prisma generate # 6. 运行数据库迁移 npx prisma migrate deploy # 7. 启动应用 pm2 delete chinese-family-tree 2>/dev/null || true PORT=8006 pm2 start npm --name "chinese-family-tree" -- start pm2 save pm2 startup systemd -u root --hp /root # 8. 查看状态 pm2 status pm2 logs chinese-family-tree --lines 20