2017-06-01 76 views
6

我最近使用Angular-CLI创建了一个新的Angular4项目。安装angular2-notifications后运行lint失败

我遇到的问题是安装angular2-notifications后,运行ng lint命令时出现错误。

错误

无法加载C:\用户\加布里埃尔\文档\ GitHub的\ GoNoGo \ GoNoGo \ node_modules \ angular2的通知\ tslint.json:找不到自定义规则目录:C:\用户\加布里埃尔\文件\ GitHub的\ GoNoGo \ GoNoGo \ node_modules \ angular2-通知\ 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 

我已经转向谷歌这个问题,没有任何运气。我去过GitHub repo,也没有运气。

然后我去了angular2-notifications包的实际tslint.json文件。

我看到在顶部:

"rulesDirectory": [ 
    "node_modules/codelyzer" 
], 

当我删除这些三线,该ng lint命令作品。

我的问题是,我在这里错过了什么?我需要这个命令来工作,我不认为修改这个包是一个可以接受的解决方案。这是我应该向他们报告的包本身的错误吗?

谢谢

回答

6

排除从皮棉配置node_modules在角cli.json:

"lint": [ 
    { 
     "project": "src/tsconfig.app.json", 
     "exclude": "**/node_modules/**/*" 
    }, 
    { 
     "project": "src/tsconfig.spec.json", 
     "exclude": "**/node_modules/**/*" 
    }, 
    { 
     "project": "e2e/tsconfig.e2e.json", 
     "exclude": "**/node_modules/**/*" 
    }] 

的angular2的通知项目显然不应该打破用户纳克皮棉。不过,我认为说一个项目不应该试图编写不应该编辑的代码也是有点公平的。