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