Windows 首次 pnpm install 时 lefthook postinstall 报 yaml: invalid leading UTF-8 octet(自愈型 bug,附根因线索) #556
Replies: 1 comment
Update: fix candidate prepared on a forkI prepared a fix candidate on my fork. Since this repo doesn't accept external PRs (issues are disabled, PR count is 0), I'm attaching the details here so the team can cherry-pick or verify it. Branch: Change: bump Why 2.1.10: the Honest limitation: the error self-healed on the reporting machine before I could capture a reproduction, so this is a version-bump candidate rather than a verified fix. Three reset scenarios (fresh marker-only If anyone with a machine that reproduces the failure can test |
Uh oh!
There was an error while loading. Please reload this page.
Windows 全新 clone 后首次 pnpm install,lefthook postinstall 报 yaml: invalid leading UTF-8 octet
复现、预期与验收
pnpm install(node 24.15.0、pnpm 11.7.0),触发 postinstallnode scripts/install-lefthook.mjslefthook.cmd install --force报Error: yaml: invalid leading UTF-8 octet,postinstall 退出码 1(--ignore-scripts可绕过)lefthook.yml本身是合法 UTF-8(hexdump 开头# Git ho纯 ASCII;lefthook dump可正常解析同一文件)——错误信息是误导性的,问题不在仓库配置文件core.hooksPath指向.git/dsh-hooks(此时目录里只有.dsh-lefthook-ownedownership marker,无 hook 文件),且.git/info/lefthook.checksum尚不存在node scripts/install-lefthook.mjs完全正常(sync hooks ✔️)。疑似 lefthook 2.1.9 在 Windows 上读取未初始化的内部状态时的 bugpnpm installpostinstall 一次通过(或脚本给出明确诊断而非误导性 YAML 错误)All reactions