diff --git a/scripts/remote_restart.sh b/scripts/remote_restart.sh index db20fb7..407c0c3 100755 --- a/scripts/remote_restart.sh +++ b/scripts/remote_restart.sh @@ -73,7 +73,9 @@ if ! curl -sf "http://127.0.0.1:${API_PORT}/health" >/dev/null; then fi echo "==> 启动 vite preview @ ${WEB_HOST}:${PORT} (base=${BASE_PATH})..." -nohup "${NPM_BIN}" exec vite preview --config scripts/vite-preview.config.mjs >>"${LOG}" 2>&1 & +VITE_BIN="${ROOT}/node_modules/vite/bin/vite.js" +[[ -f "${VITE_BIN}" ]] || { echo "❌ 缺少 ${VITE_BIN}" >&2; exit 1; } +nohup "${NODE_BIN}" "${VITE_BIN}" preview --config scripts/vite-preview.config.mjs >>"${LOG}" 2>&1 & echo $! >"${PID_FILE}" sleep 3