Comments (20)
This should also have in mind that you could have eslint installed globally with yarn, not only on NPM... that's my case. EsLint works but the message shows as if eslint is not there and it's actually working
from vscode-eslint.
You can enable tracing support by adding to your workspace settings "eslint.trace.server": "messages"
. This should print more to the output channel.
@bmarkovic if you want to load global npm modules from a different location did you tweak the npm get config prefix
setting. This should point to the gobal npm location and is respected by the ESLint extension.
from vscode-eslint.
Thanks @dbaeumer. I encountered this issue in my VSCode+eslint setup. Great pointer in your comment above. I enabled tracing support by adding "eslint.trace.server": "messages" in my settings; and noticed that "eslint.nodePath" was pointing to the wrong directory, instead of where npm global packages are installed. So, correcting that fixed it. The plugin is now loading the eslint library successfully. And linting is working!
from vscode-eslint.
+1 for me. First timer, so I didn't know it was a "new problem"
from vscode-eslint.
+1
from vscode-eslint.
It looks like the recent change to this lines up with the timing that I started seeing the error message:
34bbbf5#diff-53a5a7cf3508861eefb1979db3e79299R14
from vscode-eslint.
I was not able to reproduce this. I can successfully load the eslint library from an node_module installed into the workspace folder or globally.
@adamweeks any additional data on how to reproduce. The commit you pointed to can't be the issue since I didn't publish a new version of the eslint plugin. In addition the commit didn't change any code that is responsible for loading the eslint code. What version of eslint do you have installed globally ?
from vscode-eslint.
@dbaeumer Sorry, I was just reaching to try to figure out what caused it to stop working.
My global eslint is 1.10.3.
Running from the workspace directory:
which eslint
/usr/local/bin/eslint
eslint -v
v1.10.3
I've also run npm install eslint
in the workspace, but which
still picks up from the global path.
from vscode-eslint.
+1
Ubunutu 14.04 LTS
Code Version 0.10.6
Nodejs 5.4 (via nvm)
installed eslint eslint 1.10.3 globally (and later also in workspace)
installed eslint extension 0.10.11
... getting the error message no matter what i try
from vscode-eslint.
I've found a workaround for the problem, but not a real solution as to what was happening. By simply deleting the VS Code app and reinstalling it, the eslint plugin started working again.
from vscode-eslint.
@adamweeks this sounds very wired and I don't have an explanation for it. One question: do you have a NODE_PATH environment variable. I fixed a bug which resulted in module load failures in case there was a NODE_PATH environment present in the system.
from vscode-eslint.
@dbaeumer so after a reboot the issue has come back up. I do not have a NODE_PATH
environment variable but it does appear like I have something in common with @geroyche. We're both using nvm. I tried installing the plugin on a machine without nvm and it worked fine. There might be an issue with using this plugin along side of nvm.
from vscode-eslint.
@adamweeks to my knowledge npm tweaks the NODE_PATH variable which causes problems when I try to load the eslint plugin. For the whole discussion see #13. I will push a new version of the eslint plugin with the next VSCode release. This will contain the fix. If you want to see if this will help you can do the following:
- go to the eslint extension installation (e.g. .vscode-insiders/extensions/dbaeumer.vscode-eslint-0.10.11 in your home directory)
- go to server\node_modules\vscode-languageserver\lib
- open the file files.js
- change line 59 from
newEnv[nodePathKey] = newEnv[nodePathKey] + separator + nodePath.join(separator);
to
newEnv[nodePathKey] = nodePath.join(separator) + separator + newEnv[nodePathKey];
Let me know if it helps.
from vscode-eslint.
TL;DR:
Remove old node_modules folder from home directory
@dbaeumer that fix did not help me out so I went off to do a little investigation.
I changed line 77 in files.js
to e(toRequire)
and also modified line 50 of server.js
to:
`return Promise.reject(new vscode_languageserver_1.ResponseError(99, 'Error: ' + error, { retry: true }));
It told me that it was using eslint from ~/node_modules.
Running which eslint
pointed me to /usr/local/bin/eslint
and it reported version 2.1.0.
When I looked in ~/node_modules/eslint, it was reporting 1.0! I'm not sure what was using the node_modules in the home directory, but I've deleted it, restarted code and we are linting again!
I don't know if my setup will fix anyone else's issues, but it is worth a shot. Thanks again @dbaeumer!
from vscode-eslint.
@adamweeks that is interesting. At the end I can't fully control from where node is loading the code since it doesn depend on the environement. What I will do is to add some information in the UI to show from where the the eslint plugin loaded the eslint module so that users can track this down better
from vscode-eslint.
I also received this error and recently updated from NPM v2 to v3 which uses a different folder structure for dependencies. Suspecting this might be an issue, I removed ALL globally installed packages and re-installed them. This seems to have fixed my issue.
from vscode-eslint.
The loading code has changed quite a bit since March 2016. I will close the issue. Please ping if one still sees the issue.
from vscode-eslint.
This affects me with VS.Code 1.12.1 f6868fc Ubuntu 17.04
I have node setup so that global modules end up in ~/.node
and that is added to NODE_PATH in my .zshrc file. But ok, I understand that VS Code does not inherit my shell environment, which is why I added "eslint.nodePath": "/home/bmarkovic/.node"
to my user settings JSON file. I still get this error tho.
Also it would be very helpfull if the output did contain info where from the plugin is attempting to load the module which would help us hunt it down.
from vscode-eslint.
@dbaeumer Sorry I've missed this reply. You probably meant npm config get prefix
and yes it was set, but it was only when I made sure that in global npm config (the globalconfig
entries when you get when you do npm config list
) the prefix is set to the same location that it finally worked.
So setting it only in local npm config (~/.npmrc
in my case) doesn't cut it. Hope someone else finds this useful.
Another tip to whoever reads this later, when I was toying with this I noticed that changes in npm config were only picked up when fully restarting VS Code (as opposed to reloading the window).
from vscode-eslint.
@bmarkovic correct it is npm config get prefix
from vscode-eslint.
Related Issues (20)
- Not work of "source.fixAll.eslint": "explicit" on v3.0.10 HOT 3
- Tslint takes hours to process HOT 1
- Document behavior and defaults of useFlatConfig across ESLint v8, v9, v10 HOT 2
- [Suggestion] Mark `warn` eslint level as vscode `DiagnosticSeverity.Information` `info` level HOT 3
- `eslint.execArgv` Configuration is Not Working HOT 3
- JSON schema for useFlatConfig can be more specific HOT 1
- Should plugins still have `eslint.experimental.useFlatConfig` in their settings? HOT 1
- Support custom clickable links in eslint error tooltips HOT 1
- The extension does not show any errors anymore HOT 3
- Enfore validate list
- Error output (in flat config) causes problems not to appear in the output channel HOT 2
- Add support for ESLint feature flags HOT 4
- Restarting an extension when that extension's output is selected in the "Output" pane should not change which extension is selected in the "Output" pane. HOT 3
- ESLint with SafeQL crashes on Windows with error code 3221226505 HOT 5
- About eslint config,When user setting and workspace setting are conflict,how to override user settings config HOT 1
- ESLint is preventing my files from being saved HOT 7
- eslint autofix for multiple empty lines don't work HOT 1
- ESLint server only looks at first entry in `context.only` array sent along with `textDocument/codeAction` HOT 4
- Supervied Idenification Verification Profile HOT 2
- Setup ESLint with Deno runtime instead of node HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-eslint.