启动.command 618 B

12345678910111213141516
  1. #!/bin/bash
  2. cd "$(dirname "$0")" || exit 1
  3. # Node.js >= 22.13(内置 SQLite 驱动 node:sqlite 不再需要 flag)
  4. if ! command -v node >/dev/null 2>&1; then
  5. echo "未检测到 Node.js。请先安装 Node.js 22.13 或更高版本:https://nodejs.org/"
  6. exit 1
  7. fi
  8. 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
  9. if [ ! -d node_modules ]; then
  10. echo "正在安装依赖..."
  11. npm install || exit 1
  12. fi
  13. echo "正在启动智慧运营中台..."
  14. npm start