Skip to content
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

Fix node LSPs on Windows #11591

Closed

Conversation

LoganDark
Copy link
Contributor

I noticed #11156 after I was already mostly done with this, but it looks like that one is not going to be merged anyway.

Everything now works for me on Windows, but I'll need someone on macOS to verify it still works there too. (It should)

Release Notes:

  • Fixed Node.js-based language servers on Windows

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 9, 2024
@LoganDark
Copy link
Contributor Author

oops, looks like command prompts are popping up for each npm command. let me fix that real quick

image

@LoganDark LoganDark marked this pull request as draft May 9, 2024 12:26
@LoganDark LoganDark marked this pull request as ready for review May 9, 2024 12:53
@LoganDark
Copy link
Contributor Author

looks like the JSON and Python language servers are still broken on my machine, investigating

@LoganDark LoganDark marked this pull request as draft May 9, 2024 13:18
@LoganDark
Copy link
Contributor Author

it looks like #11156 was merged, but I'm going to ignore that for now since it was already on the path to merging when I started this. Assuming my PR ends up better, I've already rebased it on top of a revert.

@LoganDark
Copy link
Contributor Author

LoganDark commented May 9, 2024

I keep getting these:

0 verbose cli C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\node.exe C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\node_modules\npm\bin\npm-cli.js
1 info using npm@9.5.0
2 info using node@v18.15.0
3 timing npm:load:whichnode Completed in 5ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\node_modules\npm\npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\LoganDark\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\blank_user_npmrc Completed in 2ms
12 timing config:load:user Completed in 2ms
13 timing config:load:file:C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\blank_global_npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:setEnvs Completed in 5ms
16 timing config:load Completed in 17ms
17 timing npm:load:configload Completed in 17ms
18 timing npm:load:mkdirpcache Completed in 1ms
19 timing npm:load:mkdirplogs Completed in 1ms
20 verbose title npm info vscode-json-languageserver
21 verbose argv "--cache" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\cache" "--userconfig" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\blank_user_npmrc" "--globalconfig" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\blank_global_npmrc" "info" "vscode-json-languageserver" "--json" "--fetch-retry-mintimeout" "2000" "--fetch-retry-maxtimeout" "5000" "--fetch-timeout" "5000"
22 timing npm:load:setTitle Completed in 3ms
23 timing config:load:flatten Completed in 6ms
24 timing npm:load:display Completed in 7ms
25 verbose logfile logs-max:10 dir:C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\cache\_logs\2024-05-09T13_46_43_878Z-
26 verbose logfile C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\cache\_logs\2024-05-09T13_46_43_878Z-debug-0.log
27 timing npm:load:logFile Completed in 8ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 42ms
31 silly logfile start cleaning logs, removing 4 files
32 silly logfile done cleaning log files
33 timing command:info Completed in 7175ms
34 verbose type system
35 verbose stack FetchError: request to https://registry.npmjs.org/vscode-json-languageserver failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org
35 verbose stack     at ClientRequest.<anonymous> (C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
35 verbose stack     at ClientRequest.emit (node:events:513:28)
35 verbose stack     at TLSSocket.socketErrorListener (node:_http_client:502:9)
35 verbose stack     at TLSSocket.emit (node:events:525:35)
35 verbose stack     at emitErrorNT (node:internal/streams/destroy:151:8)
35 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
35 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
36 verbose cwd C:\Users\LoganDark\zed
37 verbose Windows_NT 10.0.25931
38 verbose node v18.15.0
39 verbose npm  v9.5.0
40 error code EAI_FAIL
41 error syscall getaddrinfo
42 error errno EAI_FAIL
43 error network request to https://registry.npmjs.org/vscode-json-languageserver failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org
44 error network This is a problem related to network connectivity.
44 error network In most cases you are behind a proxy or have bad network settings.
44 error network
44 error network If you are behind a proxy, please make sure that the
44 error network 'proxy' config is set properly.  See: 'npm help config'
45 verbose exit 1
46 timing npm Completed in 7245ms
47 verbose code 1
48 error A complete log of this run can be found in:
48 error     C:\Users\LoganDark\AppData\Local\Zed\node\node-v18.15.0-win-x64\cache\_logs\2024-05-09T13_46_43_878Z-debug-0.log

This should be entirely impossible, as I am connected to the internet, and I cannot reproduce this outside of Zed, so I have no idea what could be happening. Even executing the exact same command line somewhere else does not reproduce the issue. It seems like commands only intermittently work and otherwise fail with this nonsensical DNS error.

Even if I clear all environment variables from my CMD session, I can never cause getaddrinfo to fail interactively:

C:\Users\LoganDark\zed>set

C:\Users\LoganDark\zed>"C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\node.exe" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "--cache" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\cache" "--userconfig" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\blank_user_npmrc" "--globalconfig" "C:\\Users\\LoganDark\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\blank_global_npmrc" "info" "vscode-json-languageserver" "--json" "--fetch-retry-mintimeout" "2000" "--fetch-retry-maxtimeout" "5000" "--fetch-timeout" "5000"
{
  "_id": "vscode-json-languageserver@1.3.4",
  "_rev": "89-ad532c4953f078a8655bb732f8de1e34",
  "name": "vscode-json-languageserver",
  "dist-tags": {
    "next": "1.0.0-next.3",
    "latest": "1.3.4"
  },
  "versions": [
    "1.0.0-next.1",
    "1.0.0-next.2",
    "1.0.0-next.3",
    "1.0.0",
    "1.0.1",
    "1.2.0",
    "1.2.1",
    "1.2.2",
    "1.2.3",
    "1.3.0",
    "1.3.1",
    "1.3.4"
  ],
  "time": {
    "created": "2018-03-21T09:44:29.703Z",
    "1.0.0-next.1": "2018-03-21T09:44:29.810Z",
    "modified": "2022-05-23T11:03:15.875Z",
    "1.0.0-next.2": "2018-03-21T10:13:32.353Z",
    "1.0.0-next.3": "2018-03-21T10:19:59.039Z",
    "1.0.0": "2018-03-21T15:03:53.142Z",
    "1.0.1": "2018-03-21T15:27:16.822Z",
    "1.2.0": "2019-07-19T08:35:08.286Z",
    "1.2.1": "2019-07-22T08:09:10.447Z",
    "1.2.2": "2019-10-10T07:27:10.327Z",
    "1.2.3": "2020-02-17T15:00:42.762Z",
    "1.3.0": "2020-10-01T19:12:52.683Z",
    "1.3.1": "2020-10-02T13:32:22.406Z",
    "1.3.4": "2021-02-22T14:04:08.899Z"
  },
  "maintainers": [
    "microsoft <npmjs@microsoft.com>",
    "jrieken <jrieken@microsoft.com>",
    "egamma <egamma@microsoft.com>",
    "chrisdias <cdias@microsoft.com>",
    "alexandrudima <alexdima@microsoft.com>",
    "aeschli <martinae@microsoft.com>",
    "dbaeumer <dirk.baeumer@gmail.com>",
    "bpasero <benjpas@microsoft.com>",
    "isidor <inikolic@microsoft.com>",
    "joaomoreno.ms <joao.moreno@microsoft.com>",
    "kaimaetzel <kamaet@microsoft.com>",
    "octref <octref@gmail.com>"
  ],
  "description": "JSON language server",
  "author": "Microsoft Corporation",
  "license": "MIT",
  "readmeFilename": "README.md",
  "_contentLength": 72409,
  "version": "1.3.4",
  "engines": {
    "node": "*"
  },
  "bin": {
    "vscode-json-languageserver": "./bin/vscode-json-languageserver"
  },
  "main": "./out/node/jsonServerMain",
  "dependencies": {
    "jsonc-parser": "^3.0.0",
    "request-light": "^0.4.0",
    "vscode-json-languageservice": "^4.0.2",
    "vscode-languageserver": "^7.0.0",
    "vscode-uri": "^3.0.2"
  },
  "devDependencies": {
    "@types/mocha": "^8.2.0",
    "@types/node": "^12.19.9"
  },
  "scripts": {
    "prepublishOnly": "npm run clean && npm run compile",
    "compile": "npx gulp compile-extension:json-language-features-server",
    "watch": "npx gulp watch-extension:json-language-features-server",
    "clean": "../../../node_modules/.bin/rimraf out",
    "install-service-next": "yarn add vscode-json-languageservice@next",
    "install-service-local": "yarn link vscode-json-languageservice",
    "install-server-next": "yarn add vscode-languageserver@next",
    "install-server-local": "yarn link vscode-languageserver-server",
    "version": "git commit -m \"JSON Language Server $npm_package_version\" package.json"
  },
  "_nodeVersion": "12.4.0",
  "_npmVersion": "6.9.0",
  "dist": {
    "integrity": "sha512-+ghebnslXk6fVDySBrT0BVqozLDdmKY/qxgkDD4JtOQcU2vXc3e7jh7YyMxvuvE93E9OLvBqUrvajttj8xf3BA==",
    "shasum": "8b945d114caaef3c124306017d13e00b3bb1d2ef",
    "tarball": "https://registry.npmjs.org/vscode-json-languageserver/-/vscode-json-languageserver-1.3.4.tgz",
    "fileCount": 11,
    "unpackedSize": 51227,
    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgM7nZCRA9TVsSAnZWagAAhJIQAIOdzw2pqaAbAfOGOCzn\nXY0Amw98mtaLBstekIjL4ONz4Y1d62Zqka011M+WEOWDdiSAsx6KmENOKpYZ\ntBa6ZaCsL2SXQdw9o8E1RoX7DmbQkNYOW+C0/6ZjKN8YsLTdMwmOFv0HU2HL\nsuclYUM0yHIHJsSn6do5qD9ifechQ17AD9ABX2M8pi/9FX4w/xOdVuPzQ13t\nfbW6MXwub0gsv+XPgwsSGzWMsXl4Unq7SCpBU5JSHEXpHylaSvEY+FS85KF5\nQ51xvyQWloMCFMSXgM8j5lpnRlidiLb/UN7y6j2wizUP+aiA+HazCu042xMa\nXpCw2XQYjehUCFJjR3Cx9N8TbIEkQLlm8DmOUmSrUaDy+zCc8q9FizirBbgi\nG+4aLQo4vIGCDne6EPS5QbzZBQ5K3iodIVy6uaMOGF9JlJbo1W7O8yvpwym0\n2BHxYA+riIqcVr9xuG25RSTlGCTaX9TKdMQgCHahtPPOw2dDlUzTsL6IA4To\nNh+xxJP0y38zCFS2r7CsJwss4jhY4zv6Ke/Yl6HdbeoszMCyHt4N2v1qQc6b\nwap7lZH6ZH6eVz9qr4ZSFLhNLQy35LOkv+VukAJ5AY/cmr9iLsBfLLTJFss0\nafbFR3qyhS44NQtUGVEyVcwNuGsCTOiyD5c8vRMj7bmLijET6TzG5f25go3d\nCjsG\r\n=xcX8\r\n-----END PGP SIGNATURE-----\r\n",
    "signatures": [
      {
        "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
        "sig": "MEUCIQDr1Lb8L+6EDKN5AXdBuiMk5Eu/koKj4vr+kLRLeC0DvgIgVDg/RirS3gD1QeyHECFfeNrdFI2s8V0V70Pval/s7dE="
      }
    ]
  },
  "_npmUser": "aeschli <martinae@microsoft.com>",
  "directories": {},
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/vscode-json-languageserver_1.3.4_1614002648300_0.9842558362302787"
  },
  "_hasShrinkwrap": false
}

Yet it constantly fails when executed by Zed specifically.

@LoganDark
Copy link
Contributor Author

Oh well, marking as non-draft for now as I believe that NPM issue is a separate issue. With these changes I'm able to use all the language servers that will actually install correctly, maybe eventually someone will have to figure out why npm is failing for no reason but it eventually works and that's what matters. I don't believe it's anything wrong with my code, just npm being dumb.

@LoganDark LoganDark marked this pull request as ready for review May 9, 2024 14:49
...when a version is installed but you're not connected
to the internet.

Please don't delete the working local copy just because you
can't check for new versions. That's an objective negative.
My beautiful code...
@LoganDark
Copy link
Contributor Author

I've been daily driving this for a few days and it works relatively ok. Open to feedback, I'd consider this relatively merge-ready unless the DNS thing is an issue with my code instead of my computer.

@LoganDark
Copy link
Contributor Author

seems like there is an issue where paths from wasm are not normalized properly,
image

because the wasm binary itself is not windows-aware.

need to fix this

@LoganDark LoganDark marked this pull request as draft May 13, 2024 07:38
@LoganDark LoganDark marked this pull request as ready for review May 13, 2024 08:16
@LoganDark
Copy link
Contributor Author

alright now all kinds of language servers work:

  • rust-analyzer obviously works
  • built-in node language servers work (typescript, tailwind, css, python)
  • extension language servers work (html, svelte)

I don't know if I should mass-apply the changes that made the html and svelte extensions work, that pattern is repeated basically everywhere else even though version directories don't and probably never have(?) existed - I have no idea what the rationale was for these or if they're still necessary on macOS which is why I didn't already. Can someone from Zed weigh in on this?

@AcoXQ
Copy link

AcoXQ commented May 13, 2024

I have this error i dont know why i am getting this error
stdout: "{\n \"error\": {\n \"code\": \"EAI_FAIL\",\n \"summary\": \"request to https://registry.npmjs.org/@prettier%2fplugin-php failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org\",\n \"detail\": \"This is a problem related to network connectivity.\\nIn most cases you are behind a proxy or have bad network settings.\\n\\nIf you are behind a proxy, please make sure that the\\n'proxy' config is set properly. See: 'npm help config'\"\n }\n}\n" stderr: "npm ERR! code EAI_FAIL\nnpm ERR! syscall getaddrinfo\nnpm ERR! errno EAI_FAIL\nnpm ERR! network request to https://registry.npmjs.org/@prettier%2fplugin-php failed, reason: getaddrinfo EAI_FAIL registry.npmjs.org\nnpm ERR! network This is a problem related to network connectivity.\nnpm ERR! network In most cases you are behind a proxy or have bad network settings.\nnpm ERR! network \nnpm ERR! network If you are behind a proxy, please make sure that the\nnpm ERR! network 'proxy' config is set properly. See: 'npm help config'\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! C:\\Users\\acox\\AppData\\Local\\Zed\\node\\node-v18.15.0-win-x64\\cache\\_logs\\2024-05-13T21_27_15_499Z-debug-0.log\n"

@LoganDark
Copy link
Contributor Author

okay, apparently it's not just my machine then. thanks for the report. I have absolutely no fucking clue what is going wrong, so if anyone knows why zed's mere existence causes npm to suddenly fail to use the internet please let me know

@mikayla-maki
Copy link
Contributor

Thank you for the contribution @LoganDark, unfortunately this PR changes too much for us to review / merge properly. Let's try making a plan of attack for 'Node LSPs on windows' via a tracking issue, and see if we can split this up into digestible chunks :)

@LoganDark
Copy link
Contributor Author

LoganDark commented May 14, 2024

I could clean up the series of commits, a lot of them are self-contained (i.e. support zip extraction on windows, then fix the commands, then fix WASM paths etc.). this is the only way Zed works for me so I want to find a way to get this merged somehow.

FWIW I just scrolled through the final diff and it seems some of it is messed up with the reversion of #11156, which I had to rebase on top a revert of as I didn't know that was going to get merged at the time I started this (though it seems inferior to what I have now anyway, which is why I think the revert should be fine?).

@mikayla-maki
Copy link
Contributor

Putting up the commits in a series of shorter PRs for us to review and comment on, with a wider plan of attack as context (e.g. the tracking issue I mentioned), would help us review and merge this.

@LoganDark
Copy link
Contributor Author

I suppose so, it might take me a while to find time for that level of organization, but I'm open to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants