2017-06-01 77 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的通知項目顯然不應該打破用戶納克皮棉。不過,我認爲說一個項目不應該試圖編寫不應該編輯的代碼也是有點公平的。