You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code启动tsserver报错:TSServer exited. Code: null. Signal: SIGTERM

VS Code中TSServer启动失败问题

问题详情

VS Code启动TSServer时失败,尽管已识别到正确的文件路径,相关日志如下:

2023-08-25 16:18:16.644 [info] Starting TS Server undefined
2023-08-25 16:18:16.644 [info] Using tsserver from: c:\Users\Stratos\Desktop\QA\repos\lh\cypress\node_modules\typescript\lib\tsserver.js undefined
2023-08-25 16:18:16.644 [info] <syntax> Forking...
2023-08-25 16:18:16.644 [info] <syntax> Starting...
2023-08-25 16:18:16.644 [info] <semantic> Forking...
2023-08-25 16:18:16.644 [info] <semantic> Starting...
2023-08-25 16:18:16.645 [error] TSServer exited. Code: null. Signal: SIGTERM

当前settings.json配置:

"typescript.tsdk": "c:\\Users\\Stratos\\Desktop\\QA\\repos\\lh\\cypress\\node_modules\\typescript\\lib"

实际文件路径:C:\Users\Stratos\Desktop\QA\repos\lh\cypress\node_modules\typescript\lib\tsserver.js

解决方案

  • 检查Node.js版本兼容性:确认本地Node.js版本与项目依赖的TypeScript版本匹配,部分TS版本对Node.js版本有明确要求,版本不兼容可能导致服务启动异常。
  • 重置VS Code缓存:打开命令面板(Ctrl+Shift+P),执行Developer: Reload Window;或手动删除缓存目录(Windows路径为%APPDATA%\Code\Cache和%APPDATA%\Code\CachedData)后重启VS Code。
  • 重装TypeScript依赖:进入项目的cypress目录,依次执行以下命令重新安装依赖,确保文件无损坏:
    npm uninstall typescript
    npm install typescript --save-dev
    
  • 调整TSDK路径配置:尝试将typescript.tsdk改为相对路径./node_modules/typescript/lib,避免绝对路径的转义字符或权限问题。
  • 排查扩展冲突:暂时禁用所有与TypeScript、JavaScript相关的第三方扩展(如ESLint、Prettier等),重启VS Code后测试TSServer是否能正常启动,逐步排查冲突扩展。
  • 验证目录权限:确保VS Code拥有访问c:\Users\Stratos\Desktop\QA\repos\lh\cypress\node_modules目录的足够权限,避免因权限不足导致无法读取tsserver.js文件。

内容的提问来源于stack exchange,提问作者Stratos Ion

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 13:35:04