我的电脑无法在VSCode中使用任何TypeScript功能

时间:2019-01-14 13:22:49

标签: typescript visual-studio-code

我无法在自己的电脑上使用最新的VSCode(1.30.2)中的任何TypeScript功能。

以前没有问题的任何项目现在都有相同的问题。

我认为这一定是我自己的电脑问题,但我无法解决。

我该如何解决这个问题?

我尝试了此步骤,但问题仍然存在:

  • 启动code --disable-extensions,然后打开.ts文件
  • 重命名%USERPROFILE%\AppData\Roaming\Code
  • 重命名%USERPROFILE%\.vscode
  • 将VSCode降级到1.29.1
  • 重命名%USERPROFILE%\AppData\Roaming\npm
  • 使用内部人员构建

我试图安装一个非常纯净的VSCode内部人员版本,没有安装任何扩展,并创建了一个纯节点项目,但是问题仍然存在。

Screenshot

就像截图一样,每次我在状态栏上单击TypeScript的版本时,都会发生错误。

错误通知信息:

Running the contributed command:'typescript.selectTypeScriptVersion' failed.

单击版本后的完整错误日志(在“日志(扩展主机)”中):

[2019-01-14 19:51:28.132] [exthost] [error] TypeError: Cannot read property 'serviceClient' of undefined
    at t.SelectTypeScriptVersionCommand.execute (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\typescript-language-features\dist\extension.js:1:56782)
    at e._executeContributedCommand (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:484:455)
    at e.$executeContributedCommand (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:485:6)
    at t._doInvokeHandler (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:639:202)
    at t._invokeHandler (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:638:862)
    at t._receiveRequest (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:637:477)
    at t._receiveOneMessage (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:299)
    at c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:634:81
    at c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:38:994
    at e.fire (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:44:76)
    at a (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:169:881)
    at Socket.f._socketDataListener (c:\Users\username\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:170:95)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onread (net.js:636:20) typescript.selectTypeScriptVersion

VSCode内部人员信息:

Version: 1.31.0-insider (user setup)
Commit: 2ab82c12ed809fd1df921d016eed344a18a9ee8f
Date: 2019-01-14T06:18:47.017Z
Electron: 3.0.13
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

VSCode稳定信息:

Version: 1.30.2 (user setup)
Commit: 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
Date: 2019-01-07T22:54:13.295Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Windows_NT x64 10.0.17763

系统信息:

OS Name:    Microsoft Windows 10 Pro
OS Version: 10.0.17763 N/A Build 17763
node -v:    v10.14.2
npm -v:     v6.4.1

1 个答案:

答案 0 :(得分:0)

好,我发现了问题,这是我的错。

我尝试了Developer: Toggle Shared Process,然后发现了问题:我为系统变量%TEMP%设置了错误的值,它应该是D:\Temp,但是我设置了D;\Temp

某些Error: ENOENT: no such file or directory打印在开发人员工具控制台中,表明VSCode试图访问一些错误的路径。

现在,我修复了%TEMP%变量,问题已解决。

%TEMP%变量无效时,VSCode甚至无法安装任何扩展。