Claude Code windows 端 LSP 相关插件无法正常启用怎么解决?

这是我在 Finally fixed LSP on Windows [Claude Code] 上找到的解决方法。

首先,打开 claude code,然后找到日志文件

C:\Users\kiFte\.claude\debug下面,kiFte替换为你自己的用户名,最新的那个文件就是。

复制日志文件的所有文本,贴到 claude code 内,输入: “我的lsp相关插件没有正常启动,疑似是这个问题”,然后粘贴

Problem                                                                                                                                                                               
  LSP plugins fail with error:                                                                                                                                                 
  plugin:<plugin-name>:<language>: ENOENT: no such file or directory, uv_spawn '<language-server-command>'
  This occurs even when the language server binary is installed and works from the command line.
  Root Cause
  On Windows, npm global packages create .cmd wrapper files (e.g., typescript-language-server.cmd). Node.js child_process.spawn() (which uses uv_spawn internally) cannot find these binaries without the .cmd extension, unlike 
  shell environments (Git Bash, PowerShell) which resolve them automatically.
  Solution
  Add .cmd extension to the command in the LSP configuration file.
  For marketplace plugins (like typescript-lsp@claude-plugins-official):
  Edit ~/.claude/plugins/marketplaces/claude-plugins-official/.claude-plugin/marketplace.json
  Find the plugin's lspServers section and change:
  "command": "typescript-language-server",
  To:
  "command": "typescript-language-server.cmd",
  For cached plugins (like vtsls@claude-code-lsps):
  Edit ~/.claude/plugins/cache/
<marketplace>/<plugin>/<version>/.lsp.json
  Example for vtsls:
  {
    "typescript": {
      "command": "vtsls.cmd",
      "args": ["--stdio"],
      "extensionToLanguage": {
        ".ts": "typescript",
        ".tsx": "typescriptreact",
        ".js": "javascript",
        ".jsx": "javascriptreact"
      }
    }
  }
  Steps
  1. Ensure the language server is installed globally: npm install -g <package-name>
  2. Locate the LSP config file (marketplace.json or .lsp.json)
  3. Add .cmd to the command value

然后回车,让它思考,同意一切修改(或多或少还是记得审核下要修改的文件)。

在这之后,它会在一系列的艰难斗争后告诉你解决了问题。

但是,别高兴得太早,你知道的,AI 所谓的解决问题意思就是:“解决了一半的问题,但是还有问题没有解决”。

所以这个时候我们需要怎么办呢?

很简单,一次执行解决一半问题,那执行 2 次不就好了嘛!

重复上述操作,重新再来一次,我这的修复就完成了!

评论

暂无评论,快来抢沙发吧!

发表评论