-
-
Notifications
You must be signed in to change notification settings - Fork 649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSCode linting not working - Cannot find module 'eslint-plugin-vue' #976
Comments
Reverted back to ESLint 5.16.0 and works again.
|
I have the same problem recently, have you resolved it yet under the version 6.6.0 of Eslint? |
Through some of your descriptions and some issue links above, I know the cause of the problem, thank you. At the same time, I am very sorry that I didn't look carefully what you write at first. |
Verified it today with ESLint 6.6.0 and the latest eslint-plugin-vue 6.0.0 and the problem still remains. |
@yaodebian That's awesome that you figured it out, but would you mind sharing what you did? It may help someone else who has this problem in the future. |
Today I tried the following versions again.
In the above four environments, I found that the first three environments can only run normally when they are installed locally. And Only the last environment can be run normally when installed globally or locally. Therefore, I think that maybe some updates of eslint cause an error when reading the global eslint plugin. |
Maybe related to this microsoft/vscode-eslint#696 This is an expected behavior in eslint 6 as it will load plugin relatively to If you are opening vscode with non-project root, consider set each project root directory with |
THX @ThewBear , that was the issue. After setting the eslint workingdirectories in .vscode/settings.json like this:
i had also to install this dependencies:
Now everything works on the latest version of the plugins. |
For me it was just setting:
I didn't need the other plugins |
for me it was:
|
thanks,我今天也遇到了这个问题。哭。。。vscode会去顶层目录下找'eslint-plugin-vue',但我把这个项目是放在子目录下的,所以他不会生效。I got it |
Thanks, this finally solved the issue for me! |
Does someone know how I can do this if I don't use VS Code? My vue project is in frontend to but I don't know how I can tell that eslint which means I am getting the same error |
A comment from microsoft/vscode-eslint#696 that worked for me too:
the quotation marks ' are actually ` tildes |
I had this issue as well. Turns out Eslint and Prettier were fighting each other. I just went into my settings.json and commented out editor.defaultFormatter like this:
|
This fixed my problem. It was a very specific case where only the |
Tell us about your environment
Please show your full configuration:
What did you do?
clear node_modules
Had also "eslint-plugin-vue": "^5.0.0", then upgraded to 5.2.3 after reading #911
What did you expect to happen?
Expected linting to work in VSCode, like it did before.
What actually happened?
[Info - 20:43:32] ESLint server stopped.
[Info - 20:43:34] ESLint server running in node v10.11.0
[Info - 20:43:34] ESLint server is running.
[Info - 20:43:38] ESLint library loaded from: c:\proj\frontend\node_modules\eslint\lib\api.js
[Error - 20:43:38]
Failed to load plugin 'vue' declared in 'frontend.eslintrc.js': Cannot find module 'eslint-plugin-vue'
Require stack:
Referenced from: C:\proj\frontend.eslintrc.js
Happened while validating C:\proj\frontend\src\App.vue
This can happen for a couple of reasons:
Consider running eslint --debug C:\proj\frontend\src\App.vue from a terminal to obtain a trace about the configuration files used.
I dont have them installed globally:
When i did run from cmd:
C:\proj\frontend\node_modules\.bin>eslint --debug C:\proj\frontend\src\App.vue
It shows the warning for example:
eslint:ignored-paths contains: +2s
eslint:ignored-paths target = "C:\proj\frontend\src\App.vue" +2ms
eslint:ignored-paths base = "C:\proj\frontend\node_modules\.bin" +6ms
eslint:ignored-paths relative = "..\..\src\App.vue" +3ms
eslint:ignored-paths result = false +1ms
eslint:cli-engine Lint C:\proj\frontend\src\App.vue +0ms
eslint:linter Linting code for C:\proj\frontend\src\App.vue (pass 1) +0ms
eslint:linter Verify +3ms
eslint:linter With ConfigArray: C:\proj\frontend\src\App.vue +5ms
eslint:linter Apply the processor: 'vue/.vue' +3ms
eslint:linter A code block was found: '(unnamed)' +1ms
eslint:linter Generating fixed text for C:\proj\frontend\src\App.vue (pass 1) +320ms
eslint:source-code-fixer Applying fixes +0ms
eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +4ms
eslint:file-enumerator Complete iterating files: ["C:\proj\frontend\src\App.vue"] +2s
eslint:cli-engine Linting complete in: 2093ms +344ms
C:\proj\frontend\src\App.vue
13:9 warning Property name "XXX" is not PascalCase vue/name-property-casing
? 1 problem (0 errors, 1 warning)
0 errors and 1 warning potentially fixable with the
--fix
option.The text was updated successfully, but these errors were encountered: