启动.sh 543 B

123456789101112131415
  1. #!/bin/bash
  2. cd "$(dirname "$0")" || exit 1
  3. if ! command -v node >/dev/null 2>&1; then
  4. echo "未检测到 Node.js。请先安装 Node.js 22.13 或更高版本:https://nodejs.org/"
  5. exit 1
  6. fi
  7. node -e "const [a,b]=process.versions.node.split('.').map(Number);if(a<22||(a===22&&b<13)){console.error('当前 Node.js '+process.version+' 过低,需要 22.13 及以上。');process.exit(1)}" || exit 1
  8. if [ ! -d node_modules ]; then
  9. echo "正在安装依赖..."
  10. npm install || exit 1
  11. fi
  12. echo "正在启动智慧运营中台..."
  13. npm start