6

I am facing issue when I am trying to run tslint from Angular Cli.

> ng lint

Error

Failed to load E:\Projects\lsp-ui\node_modules\ng2-slimscroll\tslint.json: Could not find custom rule directory: E:\Projects\lsp-ui\node_modules\ng2-slimscroll\node_modules\codelyzer

[Error while running]

enter image description here

3
  • You are missing codelyzer in your node_modules. Did you install the dependencies (with npm install)? Commented Oct 6, 2017 at 9:40
  • Yes i did. But still its is giving same error Commented Oct 6, 2017 at 10:08
  • Try to check the versions of nodeJS, angular / angular-cli and VSC. If anything try to uninstall and re-install with all the latest versions. Commented May 7, 2018 at 8:57

2 Answers 2

0

Here is official guide for you.

Codelyzer should work out of the box with Atom but for VSCode you will have to open Code > Preferences > User Settings, and enter the following config:

{ "tslint.rulesDirectory": "./node_modules/codelyzer",
"typescript.tsdk": "node_modules/typescript/lib" }

https://github.com/mgechev/codelyzer#editor-configuration

Sign up to request clarification or add additional context in comments.

Comments

0

Run npm install or npm install codelyzer first.

Also check the file path of tsconfig.json in the Angular Cli configuration lint section, the configuration of rules directory in tslint.json, such as:

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

1 Comment

I'm not sure about this. Angular is supposed to install codelyzer: the "ng new" command is supposed to do all the installs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.