socket npm run build crashes with ERR_MISSING_OPTION: --permission on Node v24 + Next.js
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- next.js, node.js, typescript
- 领域
- build-system, cli
调研方向
检查第 67 行附近的 shadow-npm-bin2.js,并使用 Node v24 通过对比 socket npm run build 与 npm run build 来重现失败。从已启动进程的 --node-options 值中移除字面单引号,然后验证 Next.js 的 TypeScript 检查阶段是否在没有 ERR_MISSING_OPTION 的情况下完成。
由索引模型根据 Issue 内容生成。
描述
Description
socket npm run build crashes during Next.js's TypeScript checking phase on Node v24. Running npm run build directly works fine.
Root cause
In shadow-npm-bin2.js:67, the --node-options value is wrapped in literal single quotes:
`--node-options='${...}${utils.cmdFlagsToString(permArgs)}'`
Since this argument is passed via child_process.spawn() (no shell), the quotes are not interpreted — npm receives them as part of the value and sets:
NODE_OPTIONS='--permission --allow-child-process --allow-fs-read=* --allow-fs-write=...'
Node.js silently ignores the garbled tokens. However, Next.js re-parses NODE_OPTIONS for its build workers using a tokenizer that splits on whitespace and only handles " as string delimiters, not '. This causes:
'--permission(leading') → unrecognized, dropped--allow-child-process,--allow-fs-read=*,--allow-fs-write=...→ valid, kept
The TypeScript worker then receives --allow-* flags without --permission, and Node v24 throws ERR_MISSING_OPTION.
Suggested fix
Remove the single quotes — they are unnecessary and harmful when arguments are passed via spawn():
- `--node-options='${nodeOptionsArg ? nodeOptionsArg.slice(15) : ''}${utils.cmdFlagsToString(permArgs)}'`
+ `--node-options=${nodeOptionsArg ? nodeOptionsArg.slice(15) : ''}${utils.cmdFlagsToString(permArgs)}`
Repro
- Node v24.11.1, Next.js 16.2.1, Socket CLI 1.1.78 (also 1.1.76)
npm run build→ succeedssocket npm run build→ crashes at "Running TypeScript ..."
TypeError [ERR_MISSING_OPTION]: --permission is required
at node:internal/process/pre_execution:656:15
at Array.forEach (<anonymous>)
at initializePermission (node:internal/process/pre_execution:653:5)
Related
- #1036 — a separate bug on the same line where user-set
NODE_OPTIONSare replaced rather than merged
- 主要语言
- TypeScript
- 星标
- 317
- 派生
- 65
- 平均合并
- 1 小时 26 分钟
- 30 天内合并 PR
- 30
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SocketDev/socket-cli 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
SocketDev/socket-cli#1547 ·
-
难度 5/5 一周以上 新手友好度 35/100
SocketDev/socket-cli#1525 ·
-
难度 3/5 1-2 天 新手友好度 45/100
SocketDev/socket-cli#1517 ·
-
难度 3/5 1-2 天 新手友好度 68/100
SocketDev/socket-cli#1498 ·
-
难度 4/5 3-5 天 新手友好度 48/100
SocketDev/socket-cli#1497 · 1 个 reaction ·
查看 SocketDev/socket-cli 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 78/100
vicharanashala/fln#563 ·