[英]tslint update error “Cannot find module 'tslint/lib/lint'”
We recently upgraded our Angular 2 project to @angular/cli
version 1.0. 最近,我们将Angular 2项目升级到
@angular/cli
1.0版。 We also upgraded tslint
from 2.x
to 5.x
. 我们还将
tslint
从2.x
升级到5.x
Now we receive the following tslint
error at design time (in VSCode Output terminal). 现在,在设计时(在VSCode输出端子中),我们收到以下
tslint
错误。
Cannot find module 'tslint/lib/lint' while validating.
验证时找不到模块'tslint / lib / lint'。
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. 我尝试遵循一些github线程建议,包括删除不赞成使用的规则和添加新规则,将
tslint
到以前的版本,以及完全卸载和重新安装@angular/cli
和相关模块。
However, this error continues to arise and it's preventing tslint
from evaluating our code. 但是,此错误继续出现,并且阻止
tslint
评估我们的代码。
A previous SO post cited the same error message but apparently for a different reason; 先前的SO帖子引用了相同的错误消息,但显然是出于不同的原因。 the accepted answer did not resolve my issue: Error: Cannot find module 'tslint/lib/lint' when trying to extend tslint-microsoft-contrib
接受的答案不能解决我的问题: 错误:尝试扩展tslint-microsoft-contrib时找不到模块'tslint / lib / lint'
I found the issue: codelyzer
was out of date. 我发现了问题:
codelyzer
已过期。 I updated it from 0.0.26
to 2.1.1
and now tslint
is successfully linting our code. 我将其从
0.0.26
更新为2.1.1
,现在tslint
已成功将我们的代码tslint
了。
npm update codelyzer --save-dev
npm更新codelyzer --save-dev
For installing tslint simple command is : 要安装tslint,简单的命令是:
npm install tslint --save
npm install codelyzer --save
For angular: tslint installation command : 对于angular:tslint安装命令:
npm i tslint-angular --save
For typescript: tslint installation command : 对于打字稿:tslint安装命令:
npm install -g tslint typescript --save
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.