[{"data":1,"prerenderedAt":234},["ShallowReactive",2],{"posts-1-all-all":3},{"posts":4,"total":48},[5],{"id":6,"title":7,"author":8,"body":9,"category":8,"date":223,"description":224,"extension":225,"image":226,"meta":227,"navigation":63,"path":228,"recommend":8,"seo":229,"stem":230,"tags":231,"updated":8,"__hash__":233},"articles/blog/articles/20260119_01.md","解决 VSCode OXC 插件初始化失败：从 fnm 切换到 Volta",null,{"type":10,"value":11,"toc":217},"minimark",[12,24,27,31,34,118,135,137,140,154,157,175,177,180,183,198,201,213],[13,14,15,16,23],"p",{},"最近在给一个基于 Nuxt 4 的项目集成 ",[17,18,22],"a",{"href":19,"rel":20},"https://oxc.rs",[21],"nofollow","OXC","（Rust 写的超快 JS/TS 工具链），结果 VS Code 插件一启动就报「Server initialization failed」，整条工具链直接罢工。",[25,26],"hr",{},[28,29,30],"h2",{"id":30},"现象",[13,32,33],{},"VS Code 输出面板（OXC）日志片段：",[35,36,41],"pre",{"className":37,"code":38,"language":39,"meta":40,"style":40},"language-log shiki shiki-themes material-theme-lighter material-theme-lighter material-theme-palenight","2026-01-19 10:50:14.130 [info] Using server binary at: d:\\projects\\fon\\node_modules\\.bin\\oxlint\n2026-01-19 10:50:14.153 [info] 'node' 不是内部或外部命令，也不是可运行的程序\n\n2026-01-19 10:50:14.155 [info] [Error - 10:50:14] Server initialization failed.\n2026-01-19 10:50:14.155 [info]   Message: Pending response rejected since connection got disposed\n  Code: -32097\n2026-01-19 10:50:14.155 [info] [Info  - 10:50:14] Connection to server got closed. Server will restart.\n2026-01-19 10:50:14.155 [info] true\n2026-01-19 10:50:14.155 [info] [Error - 10:50:14] oxc client: couldn't create connection to server.\n2026-01-19 10:50:14.156 [info]   Message: Pending response rejected since connection got disposed\n  Code: -32097\n2026-01-19 10:50:14.156 [info] [Error - 10:50:14] Server process exited with code 1.\n","log","",[42,43,44,52,58,65,71,77,83,89,95,101,107,112],"code",{"__ignoreMap":40},[45,46,49],"span",{"class":47,"line":48},"line",1,[45,50,51],{},"2026-01-19 10:50:14.130 [info] Using server binary at: d:\\projects\\fon\\node_modules\\.bin\\oxlint\n",[45,53,55],{"class":47,"line":54},2,[45,56,57],{},"2026-01-19 10:50:14.153 [info] 'node' 不是内部或外部命令，也不是可运行的程序\n",[45,59,61],{"class":47,"line":60},3,[45,62,64],{"emptyLinePlaceholder":63},true,"\n",[45,66,68],{"class":47,"line":67},4,[45,69,70],{},"2026-01-19 10:50:14.155 [info] [Error - 10:50:14] Server initialization failed.\n",[45,72,74],{"class":47,"line":73},5,[45,75,76],{},"2026-01-19 10:50:14.155 [info]   Message: Pending response rejected since connection got disposed\n",[45,78,80],{"class":47,"line":79},6,[45,81,82],{},"  Code: -32097\n",[45,84,86],{"class":47,"line":85},7,[45,87,88],{},"2026-01-19 10:50:14.155 [info] [Info  - 10:50:14] Connection to server got closed. Server will restart.\n",[45,90,92],{"class":47,"line":91},8,[45,93,94],{},"2026-01-19 10:50:14.155 [info] true\n",[45,96,98],{"class":47,"line":97},9,[45,99,100],{},"2026-01-19 10:50:14.155 [info] [Error - 10:50:14] oxc client: couldn't create connection to server.\n",[45,102,104],{"class":47,"line":103},10,[45,105,106],{},"2026-01-19 10:50:14.156 [info]   Message: Pending response rejected since connection got disposed\n",[45,108,110],{"class":47,"line":109},11,[45,111,82],{},[45,113,115],{"class":47,"line":114},12,[45,116,117],{},"2026-01-19 10:50:14.156 [info] [Error - 10:50:14] Server process exited with code 1.\n",[13,119,120,121,124,128,130,131,134],{},"关键报错：",[122,123],"br",{},[125,126,127],"strong",{},"'node' 不是内部或外部命令，也不是可运行的程序",[122,129],{},"\n→ 插件子进程找不到 ",[42,132,133],{},"node"," 可执行文件。",[25,136],{},[28,138,139],{"id":139},"根因",[13,141,142,143,146,147,150,151,153],{},"OXC VS Code 插件在 Windows 上",[125,144,145],{},"直接 spawn 子进程","，并不会继承 fnm 的 shell 环境（",[42,148,149],{},"fnm env"," 只在交互式 shell 生效）。于是子进程找不到 ",[42,152,133],{},"，初始化直接失败。",[13,155,156],{},"相关 issue 参考：",[158,159,160,168],"ul",{},[161,162,163],"li",{},[17,164,167],{"href":165,"rel":166},"https://github.com/oxc-project/oxc/issues/17355",[21],"oxc-project/oxc#17355",[161,169,170],{},[17,171,174],{"href":172,"rel":173},"https://github.com/oxc-project/oxc/pull/15040",[21],"oxc-project/oxc#15040",[25,176],{},[28,178,179],{"id":179},"当前解决方案",[13,181,182],{},"使用其他 Node 版本管理器替代 fnm。（此处使用 Volta）",[184,185,186,189],"ol",{},[161,187,188],{},"卸载 fnm",[161,190,191,192,197],{},"安装 ",[17,193,196],{"href":194,"rel":195},"https://volta.sh/",[21],"Volta","（另一个跨平台 Node 版本管理器）",[28,199,200],{"id":200},"小结",[158,202,203,210],{},[161,204,205,206,209],{},"Windows 上 GUI 应用（含 VS Code 插件）",[125,207,208],{},"只能读到系统 PATH","，fnm 的 shell hook 机制天生无法覆盖。",[161,211,212],{},"Volta 通过「垫片」把可执行文件写进 PATH，对 GUI 和 CLI 一视同仁，兼容性更好。",[214,215,216],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":40,"searchDepth":67,"depth":67,"links":218},[219,220,221,222],{"id":30,"depth":54,"text":30},{"id":139,"depth":54,"text":139},{"id":179,"depth":54,"text":179},{"id":200,"depth":54,"text":200},"2026-01-19","最近在给一个基于 Nuxt 4 的项目集成 OXC（Rust 写的超快 JS/TS 工具链），结果 VS Code 插件一启动就报「Server initialization failed」，整条工具链直接罢工。","md","https://img.iice.fun/blog/2026/01/22/cd9867ff7a18b1252b7a8c9eeeb473b1.webp",{},"/blog/articles/20260119_01",{"title":7,"description":224},"blog/articles/20260119_01",[232,22],"VS Code","ecntxYjvZx2S1qJFt35EDep4A6c1kaTcb-TmmLvDHgI",1781337825763]