症状
同一个项目,在笔记本上打开是正常的,到了台式机上一直在初始化 typscript
语言服务,
输出显示
[Error - 9:59:09 PM] ReaderError
RangeError: out of range index
at Buffer.copy (buffer.js:602:18)
at l.tryReadContent (d:\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:161851)
at t.Reader.onLengthData (d:\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:162417)
at Socket.t.Reader.i.Disposable.constructor.e.on.e (d:\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:162184)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at Pipe.onread (net.js:594:20)
[Error - 9:59:09 PM] TSServer exited with code: 3
解决方法
- 在设置里增加
"typescript.tsserver.log": "verbose",
- 重启vscode,再次查看输出,会在第二行出现日志文件路径
- 等到输出报错后,打开日志文件,查看报错原因
- 才发现是有
.ts视频文件
也被识别进去 - 删除.ts视频文件或在
tsconfig.json
加入排除文件夹"exclude": []
报错原因有多种具体请用1、2、3步自行查看或到vscode 提交issues并附上日志内容
转载请保留原文链接: https://zodream.cn/blog/id/31.html