【发布时间】:2017-11-01 23:14:17
【问题描述】:
我最近使用 Angular-CLI 创建了一个新的 Angular4 项目。
我遇到的问题是在安装 angular2-notifications 后,运行 ng lint 命令时出现错误。
错误:
加载 C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\angular2-notifications\tslint.json 失败:找不到自定义规则目录:C:\Users\Gabriel\Documents\GitHub \Go-NoGo\GoNoGo\node_modules\angular2-notifications\node_modules\codelyzer
堆栈跟踪:
at new FatalError (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\tslint\lib\error.js:40:23)
at Object.findConfiguration (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\tslint\lib\configuration.js:47:15)
at files.forEach (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\tasks\lint.js:36:50)
at Array.forEach (native)
at lintConfigs.map (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\tasks\lint.js:30:19)
at Array.map (native)
at Class.run (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\tasks\lint.js:21:14)
at Class.run (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\commands\lint.js:45:25)
at Class.Command.validateAndRun (C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\ember-cli\lib\models\command.js:128:15)
at C:\Users\Gabriel\Documents\GitHub\Go-NoGo\GoNoGo\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:92:22
我已针对此问题求助于 Google,但没有任何运气。我去过GitHub repo,也没有运气。
然后我进入了 angular2-notifications 包的实际 tslint.json 文件。
我在顶部看到这个:
"rulesDirectory": [
"node_modules/codelyzer"
],
当我删除这 3 行时,ng lint 命令有效。
我的问题是,我在这里遗漏了什么吗?我需要这个命令才能工作,我认为修改包不是一个可以接受的解决方案。这是我应该向他们报告的包本身的错误吗?
谢谢
【问题讨论】: