Files
AiclwHome/start.sh
2026-03-10 17:13:55 +08:00

29 lines
634 B
Bash
Raw 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.
#!/usr/bin/env bash
set -e
# 项目根目录
ROOT="$(cd "$(dirname "$0")" && pwd)"
echo "== 检查 Node / npm =="
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
echo "未检测到 node 或 npm请先安装 Node.js 再运行本脚本。"
exit 1
fi
echo "== 安装后端依赖 =="
cd "$ROOT/backend"
npm install
echo "== 启动后端 (http://localhost:3000) =="
npm run dev &
BACKEND_PID=$!
echo "== 安装前端依赖 =="
cd "$ROOT/frontend"
npm install
echo "== 启动前端 (http://localhost:5173) =="
npm run dev
echo "== 结束前关闭后端 =="
kill "$BACKEND_PID" 2>/dev/null || true