Vahid
Vahid

Reputation: 5444

Failed to load the TSLint library for the document in Visual Studio Code

I have installed the latest versions of Visual Studio Code, Node.js, and Typescript on my Windows 10 machine. However, when I try to use TSLint in the terminal, I get the following error message:

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

I tried reinstalling TSLint, but I got the following error message:

npm install -g tslint

And got the following message:

npm WARN [email protected] 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 [email protected] 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.

+ [email protected]
updated 1 package in 1.853s

Restarting Visual Studio Code did not help, and I am still getting the error message that TSLint cannot be loaded.

How can I fix this issue and use TSLint in Visual Studio Code?

Upvotes: 1

Views: 1379

Answers (2)

Josh
Josh

Reputation: 3440

tsutils and typescript are "peer" dependencies of TSLint, meaning TSLint requires that they be installed but won't do it for you _(this helps make sure TSLint uses the dependency versions you have, rather than providing confusingly different versions on its own). Try:

npm i tsutils typescript

...to install them manually.

Upvotes: 1

Karol Majewski
Karol Majewski

Reputation: 25790

Isn't that error message informing you about the missing extension? It bundles its own version of TSLint.

Try installing the vscode-tslint extension.

Upvotes: 0

Related Questions