Cannot find eslint formatters module
YodasWs opened this issue · 3 comments
I am trying to run sass-lint through gulp-sass using eslint 6.0.1, but I get the following error message:
Error: Cannot find module 'eslint/lib/formatters/stylish'
Require stack:
- node_modules/sass-lint/index.js
- node_modules/gulp-sass-lint/index.js
- node_modules/gulp-load-plugins/index.js
- gulpfile.js
- /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/index.js
- /usr/local/lib/node_modules/gulp/bin/gulp.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Function.sassLint.format (node_modules/sass-lint/index.js:257:19)
at Function.sassLint.outputResults (node_modules/sass-lint/index.js:276:26)
at DestroyableTransform._transform (node_modules/gulp-sass-lint/index.js:77:12)
at DestroyableTransform.Transform._read (node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (node_modules/readable-stream/lib/_stream_transform.js:172:83)
at doWrite (node_modules/readable-stream/lib/_stream_writable.js:428:64)
I can run eslint through gulp-eslint without hitting this error.
For anybody stopping by with the same issue, based on a similar issue here, it seems that the problem is sass-lint's dependence upon an older version of ESLint. I tried downgrading from ESLint 7.32.0 to 5.16.0 and sass-lint worked. Not a workable solution for me, but a fun little experiment nontheless.
FWIW, I switched to Stylelint, at least for the time being. Last release was 20 days ago at time of writing...
Create .sass-lint.yml
if you don't already have one and add this to it:
options:
formatter: '../cli-engine/formatters/stylish'
Then force sass-lint
to use an updated eslint
with one of these
- Yarn: Add an entry to your
resolutions
with"sass-lint/eslint": "^8.42.0"
or"**/eslint": "^8.42.0"
. - NPM: Add an entry to your
overrides
with"sass-lint": { "eslint": "^8.42.0" }
I have tested the Yarn solution but not the NPM one.