【问题标题】:Failed to load the TSLint library for the document in Visual Studio Code无法在 Visual Studio Code 中加载文档的 TSLint 库
【发布时间】:2019-05-12 23:55:50
【问题描述】:

我在 Windows 10 上安装了最新版本的 Visual Studio Code、Node.js 和 Typescript。不幸的是,我在终端中收到以下消息。

Failed to load the TSLint library for the document...

我再次尝试安装 TSLint。

npm install -g tslint

并收到以下消息:

npm WARN tslint@5.11.0 requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@2.29.0 requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev but none is installed. You must install peer dependencies yourself.

+ tslint@5.11.0
updated 1 package in 1.853s

重新启动 VSC 没有帮助,我仍然收到无法加载 TSLint 的消息。

  • TSC 3.2.2
  • VSC 1.29.1

【问题讨论】:

  • 错误出现在哪里?在终端还是在编辑器中?

标签: typescript npm visual-studio-code tslint tsc


【解决方案1】:

该错误消息不是通知您缺少扩展程序吗?它捆绑了自己的 TSLint 版本。

尝试安装vscode-tslint 扩展。

【讨论】:

    【解决方案2】:

    tsutilstypescript 是 TSLint 的“对等”依赖项,这意味着 TSLint 要求安装它们但不会为您安装 _(这有助于确保 TSLint 使用您拥有的依赖项版本,而不是提供令人困惑的不同版本)。试试:

    npm i tsutils 打字稿

    ...手动安装它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-27
      • 1970-01-01
      • 2019-01-09
      • 1970-01-01
      • 1970-01-01
      • 2018-01-04
      • 1970-01-01
      • 2015-07-23
      相关资源
      最近更新 更多