tslint update error "Cannot find module 'tslint/lib/lint'"
Asked Answered
C

2

5

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

Curculio answered 10/4, 2017 at 18:0 Comment(0)
C
5

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

Curculio answered 10/4, 2017 at 18:0 Comment(0)
C
2

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 
Curable answered 22/10, 2018 at 11:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.