Agent Skillsai-shifu/ai-shifu › next-build-node-runtime

next-build-node-runtime

GitHub

用于排查 Next.js 构建时因 Node 版本不兼容导致的语法错误。通过检查运行时版本、对照引擎要求并修复环境,解决 Unexpected token 报错,确保构建顺利进行。

src/cook-web/skills/next-build-node-runtime/SKILL.md ai-shifu/ai-shifu

Trigger Scenarios

npm run build 报 SyntaxError Unexpected token '?' next/dist/compiled 内部文件报语法错误

Install

npx skills add ai-shifu/ai-shifu --skill next-build-node-runtime -g -y
More Options

Non-standard path

npx skills add https://github.com/ai-shifu/ai-shifu/tree/main/src/cook-web/skills/next-build-node-runtime -g -y

Use without installing

npx skills use ai-shifu/ai-shifu@next-build-node-runtime

指定 Agent (Claude Code)

npx skills add ai-shifu/ai-shifu --skill next-build-node-runtime -a claude-code -g -y

安装 repo 全部 skill

npx skills add ai-shifu/ai-shifu --all -g -y

预览 repo 内 skill

npx skills add ai-shifu/ai-shifu --list

SKILL.md

Frontmatter
{
    "name": "next-build-node-runtime",
    "description": "当 cook-web 执行 npm run build 出现 SyntaxError Unexpected token '?' 或 next\/dist\/compiled 报错时使用本技能,优先排查 Node 运行时版本不一致问题。"
}

Next Build Node 运行时排障

触发条件

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

工作流

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

Version History

  • e65aa77 Current 2026-08-20 15:14

Same Skill Collection

src/api/skills/shifu-authoring-flow/SKILL.md
src/api/skills/user-auth-flows/SKILL.md
src/cook-web/skills/app-error-boundary-display/SKILL.md
src/cook-web/skills/async-confirm-dialog-loading/SKILL.md
src/cook-web/skills/chat-actionbar-ask-placement/SKILL.md
src/cook-web/skills/chat-element-streaming/SKILL.md
src/cook-web/skills/chat-layout-width-detection/SKILL.md
src/cook-web/skills/deep-link-lessonid-routing/SKILL.md
src/cook-web/skills/fullscreen-dialog-portal/SKILL.md
src/cook-web/skills/interaction-user-input-defaults/SKILL.md
src/cook-web/skills/listen-mode-audio-streaming/SKILL.md
src/cook-web/skills/listen-mode-slide-mobile-integration/SKILL.md
src/cook-web/skills/markdownflow-controlled-sync/SKILL.md
src/cook-web/skills/module-augmentation-guardrails/SKILL.md
src/cook-web/skills/shared-loading-dots/SKILL.md
src/cook-web/skills/hook-contract-refactor-safety/SKILL.md

Metadata

Files
0
Version
e65aa77
Hash
e95b6c86
Indexed
2026-08-20 15:14

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 10:11
浙ICP备14020137号-1 $방문자$