ai-shifu

next-build-node-runtime

This skill diagnoses Next.js build failures in Cook Web, including errors from next/dist/compiled and syntax errors such as Unexpected token '?'. It checks Node and npm versions against package.json, resolves runtime mismatches, and identifies the first blocking error.

ai-shifu 327 126 Actualitzat fa 1 mes
GitHub

Instal·la

npx skillscat add ai-shifu/ai-shifu/next-build-node-runtime

Instal·la des del registre de SkillsCat.

Sobre aquest skill

This skill diagnoses Next.js build failures in Cook Web, including errors from next/dist/compiled and syntax errors such as Unexpected token '?'. It checks Node and npm versions against package.json, resolves runtime mismatches, and identifies the first blocking error.

SKILL.md

Next Build Node 运行时排障

触发条件

  • npm run build 在 next/dist/compiled 内部文件报语法错误。
  • 报错包含 SyntaxError: Unexpected token '?'、Unexpected token '.' 等现代语法不兼容信息。
  • 构建日志中 Warning 很多,但实际中断点不明确。

工作流

  1. 在当前目录分别检查运行时版本与路径:node -v、npm -v、which node、which npm。
  2. 对照 package.json 的 engines.node,确认是否匹配。
  3. 如果 shell 初始化脚本切到了旧 Node,先切到项目要求版本再重新执行 npm run build。
  4. 构建失败时只抓第一个 Error 作为阻断点,不把 Warning 当作失败原因。
  5. 若阻断点是 ESLint Error,做最小改动修复;保留调试日志,不删除 console.log。

Categories