fix: add npm registry fallback when npmmirror is unreachable
Deploy Dashboard (Dev) / Frontend Tests (push) Has been cancelled
Deploy Dashboard (Dev) / Deploy to Dev (push) Has been cancelled
Deploy Dashboard (Dev) / Backend Tests (push) Has been cancelled

CI runner in China may lose connectivity to npmmirror. Falls back
to default npmjs.org registry when npm ci fails with connector errors.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-05-07 22:22:57 +08:00
parent b092ab4583
commit 3b8388f01c
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -176,11 +176,11 @@ jobs:
else
echo "Cache corrupted, installing fresh..."
rm -rf node_modules
npm ci
npm ci || { echo "mirror failed, trying default registry..."; npm config set registry https://registry.npmjs.org; npm ci; }
fi
else
echo "Installing fresh dependencies..."
npm ci
npm ci || { echo "mirror failed, trying default registry..."; npm config set registry https://registry.npmjs.org; npm ci; }
echo "Saving to cache $CACHE_KEY..."
cp -a node_modules $CACHE_DIR/ || echo "Warning: cache save failed"
fi