简体   繁体   中英

tslint update error “Cannot find module 'tslint/lib/lint'”

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

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

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM