Replies: 1 comment 1 reply
|
先给结论:确认是 alpha.2 的真实回归,你的定位基本全对,而且我找到了具体触发器——alpha.2 把普通启动的解析模式默认值从 证据(均对照 HEAD = ddefc45,v0.1.6-alpha.2):
第二层失败(补守卫后的 临时规避:没有 profile 级开关(apps/cli/src/args.ts 无任何 resolution-mode flag,runCli 不传该选项)。稳妥做法就是你已经做的回滚 alpha.1;若必须跑 alpha.2 源码,可把 profile-boot.ts:263 改回 如果你手上有 alpha.2 启动失败那几行的完整 stderr(~/.dsh/web.err.log),贴出来可以进一步确认是否还有别的 builtin 裸名走了同一路径。 |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR (EN) — On
0.1.6-alpha.2a profile whose plugin tree pulls injsdom(→whatwg-url→tr46→require("punycode/")) cannot boot: the plugin tree aborts insideResolutionRouter.routeScoped, the host exits, and launchd restarts it forever. The identical profile boots and runs for days on0.1.6-alpha.1/0.1.5-rc.1. Locally adding the?? []guard that the same file already uses elsewhere moves the failure one step further, toCannot find module 'punycode/'insideresolveRoutedCjs.环境
alphatag 直装,失败)/对照 0.1.6-alpha.1(同机同 profile,正常)web,18 个第三方 bundle其中 4 个插件都依赖 jsdom(所以这不是很偏门的组合):
dsh-web-search-prodshmarketdsh-univer-office@a9i5k4/dsh-literature依赖链版本:
jsdom 29.1.1→whatwg-url 16.0.1→tr46 6.0.0→require("punycode/")。punycode@2.3.1已装在 profile 自己的node_modules里(这一步很关键,见第二层)。复现
dsh plugin --profile web add dsh-web-search-pro);0.1.6-alpha.2启动该 profile;一个容易误判的点:循环期间服务偶尔能回 401/200(webserver 早于插件树绑定),所以「HTTP 通」不能当健康证据;真正的判据是
launchctl print的runs计数在持续增长(本次从 1 涨到 24+)。第一层错误
tr46/index.js第 3 行是require("punycode/")。Node 的require.resolve.paths("punycode")对核心模块名返回null,而routeScoped直接→
TypeError: … is not iterable。值得注意的是:同一个文件里官方自己在另一处已经写了这个守卫(alpha.2 第 882 行:
createRequire(anchor).resolve.paths(packageName) ?? []),但另外三处漏了——alpha.2 的第 1189 / 1327 / 1927 行(alpha.1 对应 1129 / 1267 / 1867)。第二层错误(补上守卫之后暴露出来的)
本地把那三处补成
?? []之后,崩溃点前移到路由本身:也就是说:这个
punycode/(带尾斜杠的裸标识符)被路由接管后没能解析成功,而原生解析本应成功——…/profiles/web/node_modules/punycode/确实存在(2.3.1)。为什么判断这是 alpha.2 的回归
resolve.paths调用在 alpha.1 里也存在,说明变化点不是这行代码本身,而是这条 require 在 alpha.2 走到了这段路由。两版dsh-app-boot/lib/index.js有 563 行差异(alpha.2 新增了dsh-lazy-require、dsh-atomic-write、dsh-plugin-manager、dsh-hmr等包,并移除了cordis-plugin-hmr)。建议
createRequire(parent).resolve.paths(name)→… ?? [](1189 / 1327 / 1927 三处,与 882 行保持一致)。核心模块没有搜索路径,空迭代即回落到原生解析,语义正确。resolveRoutedCjs对「核心模块名」或「带尾斜杠的裸标识符」应直接交回原生解析;或在路由目标不存在时回退到原生解析,而不是抛Cannot find module。--json字段),便于自动回滚——本次是靠runs计数才及时发现的。附:如何确认是不是同一个问题
当前已回滚到
0.1.6-alpha.1(vendor 整树回滚 + 服务恢复,三个 profile 均正常)。alpha.2 里那些新特性(插件管理页、HMR、文件改动卡片)很想用,等这条修好再上。All reactions