Giter VIP home page Giter VIP logo

Comments (20)

nahuelhds avatar nahuelhds commented on August 16, 2024 3

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.

dbaeumer avatar dbaeumer commented on August 16, 2024 2

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.

obkalu avatar obkalu commented on August 16, 2024 1

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.

dncrews avatar dncrews commented on August 16, 2024

+1 for me. First timer, so I didn't know it was a "new problem"

from vscode-eslint.

joelmartinez avatar joelmartinez commented on August 16, 2024

+1

from vscode-eslint.

adamweeks avatar adamweeks commented on August 16, 2024

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.

dbaeumer avatar dbaeumer commented on August 16, 2024

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.

adamweeks avatar adamweeks commented on August 16, 2024

@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.

geroyche avatar geroyche commented on August 16, 2024

+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.

adamweeks avatar adamweeks commented on August 16, 2024

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.

dbaeumer avatar dbaeumer commented on August 16, 2024

@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.

adamweeks avatar adamweeks commented on August 16, 2024

@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.

dbaeumer avatar dbaeumer commented on August 16, 2024

@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.

adamweeks avatar adamweeks commented on August 16, 2024

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.

dbaeumer avatar dbaeumer commented on August 16, 2024

@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.

ShimShamSam avatar ShimShamSam commented on August 16, 2024

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.

dbaeumer avatar dbaeumer commented on August 16, 2024

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.

bmarkovic avatar bmarkovic commented on August 16, 2024

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.

bmarkovic avatar bmarkovic commented on August 16, 2024

@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.

dbaeumer avatar dbaeumer commented on August 16, 2024

@bmarkovic correct it is npm config get prefix

from vscode-eslint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.