WebStorm tslint initialization error from node_modules file Follow
Using the 10/3/2018 version of WebStorm.
I keep getting this error every time I edit a .ts or .tsx file:
TSLint: Initialization error (tslint). /Users/mpelzsherman/source/my_project/node_modules/chalk/index.js
1. Why is tslint analyzing files in node_modules?
2. Why is tslint analyzing .js a file?
Please sign in to leave a comment.
Error indicates that the TSLint service can't be started, it's not trying to lint your .js files.
Please provide a screenshot of error message (as it's displayed in console) plus your idea.log (https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files), package.json and tslint.json files
works fine for me using your configuration + package.json.
Do you have Details.. link in error notification? Like:
If yes, please click this link and provide the output.
Also, what Node.js version is chosen in Settings | Languages & Frameworks | TypeScript | TSLint? Please provide the screenshot of this page plus your idea.log
Sorry but I can't sent you my idea.log as it may contain sensitive data. Thanks for your help!
Node.js version you are using (0.12.0) is very old and doesn't support ES2015 syntax; as a result, TSLint initialization fails on loading chalk module, on line 2 of index.js:
const escapeStringRegexp = require('escape-string-regexp');
Use of const in strict mode.
Running npm run tslint in terminal will fails as well:
Node version 0.12.0 is not supported, please use Node.js 4.0 or higher.
Your project requires Node.js 8 or higher:
Please make sure to choose appropriate Node.js version in TSLint settings
Thanks! I didn't notice the node version was incorrect!
Our project has a .node-version file so I thought perhaps WebStorm would be smart enough to use the version specified in it. Feature request? :-)
The error has stopped after correcting the node version.