简体   繁体   English

错误:在尝试扩展tslint-microsoft-contrib时找不到模块'tslint / lib / lint'

[英]Error: Cannot find module 'tslint/lib/lint' when trying to extend tslint-microsoft-contrib

This is our environment 这是我们的环境

> \node_modules\.bin\tslint --version
4.0.1

> npm install --save-dev tslint-microsoft-contrib
`-- tslint-microsoft-contrib@2.0.13

This is our tslint.json configuration. 这是我们的tslint.json配置。

{
    "extends": [
        "./node_modules/tslint-microsoft-contrib/tslint.json"
    ]
}

This is what happens when we run our local tslint with that configuration. 当我们使用该配置运行本地tslint时会发生这种情况。

> node_modules\.bin\tslint --config .\tslint.json --project .\tsconfig.json
module.js:471
throw err;
^

Error: Cannot find module 'tslint/lib/lint'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\myApp\node_modules\tslint-microsoft-contrib\insecureRandomRule.js:7:12)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)     

How can we run tslint on a configuration that extends tslint-microsoft-contrib ? 我们如何在扩展tslint-microsoft-contrib的配置上运行tslint

You need to downgrade to tslint 3.xx, tslint-microsoft-contrib doesn't yet support tslint 4, PR #314 should fix that, the PR looks done, but the tests require grunt-tslint to be upgraded to support tslint 4 as well. 你需要降级到tslint 3.xx,tslint-microsoft-contrib还不支持tslint 4,PR #314应该修复,PR看起来已经完成,但测试需要升级grunt-tslint以支持tslint 4好。 For the mean time, you can continue to use tslint@3 同时,您可以继续使用tslint @ 3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tslint错误:找不到模块&#39;redux / todo / actions&#39;.ts(2307) - tslint error: Cannot find module 'redux/todo/actions'.ts(2307) 找不到模块&#39;./.../x.html&#39; - TsLint / Angular-Meteor - Cannot find module './…/x.html' - TsLint / Angular-Meteor Web分析器TSLint报告错误TS2307在忽略的node_modules文件中找不到模块&#39;@ angular / core&#39; - Web Analyzer TSLint reports error TS2307 Cannot find module '@angular/core' in ignored node_modules files 尝试使用 React + TypeScript 项目修复 tslint 错误 - Trying to fix tslint error with React + TypeScript project tslint:不允许使用名称空间和模块 - tslint: namespace and module are disallowed Angular TSLint - 找不到构建器“@angular-devkit/build-angular:tslint” - Angular TSLint - Cannot find builder "@angular-devkit/build-angular:tslint" 带有 Angular 7 和 `ng lint` 的 TypeScript 中的自定义 TSLint 规则 - Custom TSLint Rule in TypeScript with Angular 7 and `ng lint` 如何使用 tslint lint 整个文件夹 - How to lint entire folder using tslint 尝试使用最新版本的 ant 设计时出现 TSLint 错误 - TSLint errors when trying to use newest version of ant design VSCode:tslint-language-service插件将lint提示显示为错误而不是警告 - VSCode: tslint-language-service plugin shows lint hints as error and not warning
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM