We have a project built on angular-cli that also uses a package that was built on angular-cli. So our project has a tslint.json and so does the package. Since codelyzer is at the same version in both the project and the package then npm flattens the tree and installs codelyzer in the root node_modules folder; this is fine, and expected.
When we run ng lint we get this error:
Failed to load /Users/my-user/Documents/my-project/node_modules/my-package/tslint.json: Could not find custom rule directory: node_modules/codelyzer
This started happening since 3.x, and I cannot tell what the issue is, but I found a fix: just go into node_modules/my-package and run npm install codelyzer so it creates a local node_modules inside the package folder with just codelyzer in it at the same exact version as the codelyzer in the root node_modules. After doing this, ng lint works fine again.
I've searched for this issue on other packages and found a couple of similar reports:
The fix for ngx-uploader seems to be just removing tslint and codelyzer altogether but we cannot do this.
The issue reported on StackOverflow regarding the angular2-notifications package has no answers.
Perhaps another thing worth mentioning is that codelyzer and tslint are not listed in the package.json in our project because it is scaffolded with an in-house cli tool that basically just installs the packages without saving them to the package.json in a postinstall script.
This is all I could find so far. Any ideas why this is happening, and how we can fix it without having to go into the package folder and installing codelyzer manually everytime?
We have a project built on angular-cli that also uses a package that was built on angular-cli. So our project has a tslint.json and so does the package. Since codelyzer is at the same version in both the project and the package then npm flattens the tree and installs codelyzer in the root
node_modulesfolder; this is fine, and expected.When we run
ng lintwe get this error:This started happening since 3.x, and I cannot tell what the issue is, but I found a fix: just go into
node_modules/my-packageand runnpm install codelyzerso it creates a localnode_modulesinside the package folder with just codelyzer in it at the same exact version as the codelyzer in the rootnode_modules. After doing this,ng lintworks fine again.I've searched for this issue on other packages and found a couple of similar reports:
The fix for ngx-uploader seems to be just removing tslint and codelyzer altogether but we cannot do this.
The issue reported on StackOverflow regarding the angular2-notifications package has no answers.
Perhaps another thing worth mentioning is that codelyzer and tslint are not listed in the package.json in our project because it is scaffolded with an in-house cli tool that basically just installs the packages without saving them to the package.json in a postinstall script.
This is all I could find so far. Any ideas why this is happening, and how we can fix it without having to go into the package folder and installing codelyzer manually everytime?