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