#!/usr/bin/env node /** * 生成 Next.js Server Actions 加密密钥 * 用于解决 "Failed to find Server Action" 部署错误 * * 用法: node scripts/generate-encryption-key.js * 将输出的 base64 字符串设置为环境变量 NEXT_SERVER_ACTIONS_ENCRYPTION_KEY * 在构建时设置(pnpm build 前 export 或 .env 中配置) */ const crypto = require("crypto"); const key = crypto.randomBytes(32).toString("base64"); console.log("将以下值设置为 NEXT_SERVER_ACTIONS_ENCRYPTION_KEY:\n"); console.log(key);