3
votes

We recently upgraded our Angular 2 project to @angular/cli version 1.0. We also upgraded tslint from 2.x to 5.x. Now we receive the following tslint error at design time (in VSCode Output terminal).

Cannot find module 'tslint/lib/lint' while validating.

I've attempted to follow several github thread suggestions including removing deprecated rules and adding new rules, rolling back tslint to a previous version and completely uninstalling and reinstalling @angular/cli and associated modules.

However, this error continues to arise and it's preventing tslint from evaluating our code.

A previous SO post cited the same error message but apparently for a different reason; the accepted answer did not resolve my issue: Error: Cannot find module 'tslint/lib/lint' when trying to extend tslint-microsoft-contrib

2

2 Answers

4
votes

I found the issue: codelyzer was out of date. I updated it from 0.0.26 to 2.1.1 and now tslint is successfully linting our code.

npm update codelyzer --save-dev

2
votes

For installing tslint simple command is :

npm install tslint --save 


 npm install codelyzer --save 

For angular: tslint installation command :

npm i tslint-angular --save 

For typescript: tslint installation command :

 npm install -g tslint typescript --save