fix(build): drop node-sass (no Node20 prebuilt); CI strips it from lockfile before npm ci
deploy-userbase-front / build-and-deploy (push) Successful in 27s

This commit is contained in:
chenxing
2026-08-04 22:10:13 +08:00
parent 6c4d800c26
commit aa0724dc49
2 changed files with 8 additions and 2 deletions
+8 -1
View File
@@ -28,9 +28,16 @@ jobs:
working-directory: front
run: npm config set registry https://registry.npmmirror.com
# node-sass(6.x) 无 Node20 预编译二进制,源码编译必失败;项目实际用 dart-sass(sass)。
# 本地 lockfile 暂不便修改,这里在 runner 内把它从 lockfile 剔除后再 npm ci(不改仓库文件)。
- name: Strip node-sass from lockfile (CI-only)
run: |
node -e "const fs=require('fs');const p='front/package-lock.json';const d=JSON.parse(fs.readFileSync(p,'utf8'));const pk=d.packages||{};for(const k of Object.keys(pk)){if(k==='node_modules/node-sass'||k.startsWith('node_modules/node-sass/'))delete pk[k];}if(d.dependencies&&d.dependencies.node-sass)delete d.dependencies.node-sass;fs.writeFileSync(p,JSON.stringify(d,null,2));"
echo "node-sass stripped from lockfile"
- name: Install dependencies
working-directory: front
run: npm ci
run: npm ci --no-audit --no-fund
- name: Build (prod -> dist/prod)
working-directory: front
-1
View File
@@ -35,7 +35,6 @@
"@unocss/preset-uno": "^66.6.0",
"@vitejs/plugin-vue": "^5.0.4",
"fast-glob": "^3.3.2",
"node-sass": "^6.0.1",
"sass-loader": "^10.0.1",
"typescript": "^5.2.2",
"unocss": "^66.6.0",