fix(restart): invoke vite preview binary directly on 103

npm exec misparsed --config on Node 24/npm 11, causing preview to bind
4173 without /ops proxy and failing release health checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-29 10:02:54 +08:00
parent 17e0410c32
commit 41252ec2cb
+3 -1
View File
@@ -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