VSCode的Eslint插件运行失败 Cannot find module 'eslint-plugin-vue'

4,486 阅读1分钟

VSCode linting not working - Cannot find module 'eslint-plugin-vue'

可以直接看这个issue

Maybe related to this [microsoft/vscode-eslint#696](https://github.com/microsoft/vscode-eslint/issues/696)

This is an expected behavior in eslint 6 as it will load plugin relatively to cwd

If you are opening vscode with non-project root, consider set each project root directory with eslint.workingDirectories.
More suggestion: microsoft/vscode-eslint#696 (comment)

大致意识是,vscode会去顶层目录下找'eslint-plugin-vue',但当我把这个项目是放在子目录下的,所以他不会生效。

总结

我一开始使劲google,没找到什么有用信息 ,只找到了这篇文章Cannot find module 'eslint-plugin-vue' 报错解决。正当我心灰意冷想去提个issue的时候,我提之前搜索了下问题,瞬间找到解决方案