Sublime Forum

ST4: LSP fails to install (any) language server

#41

No, I have completely removed NVM for now.
All traces of it. I just installed the latest official NodeJS LTS version aka 20.9.0.

0 Likes

#42

Okay.

{
    // Specifies the type and priority of the Node.js installation that should be used for Node.js-based servers.
    // The allowed values are:
    //  - 'system' - a Node.js runtime found on the PATH
    //  - 'local' - a Node.js runtime managed by LSP that doesn't affect the system
    // The order in which the values are specified determines which one is tried first,
    // with the later one being used as a fallback.
    // You can also specify just a single value to disable the fallback.
    "nodejs_runtime": ["local"],
    "local_use_electron": false,
}

This settings should work under any circumstances regardless of user’s environment. Otherwise, there may be something wrong in lsp_utils.

0 Likes

#43

Let me try specify the electron flag now. It should work but you never know :slight_smile:

0 Likes

#44

So, I tried with specifying the electron flag to false explicitly.
Restarted ST4 and everything looked fine.
Tried with true and restarted ST4. It downloaded Node JS runtime again and everything seemed fine.
Changed the flag back to false and now I get this:

image

Console log below:
[lsp_utils] Deleting outdated Node.js runtime directory “C:\Users\diakosi7344\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\18.17.1”
— lsp_utils Node.js resolving start —
Resolving Node.js Runtime from lsp_utils for package LSP-json…
* Binaries check failed: “node” binary not found
* Failed downloading: [WinError 3] The system cannot find the path specified: ‘C:\Users\diakosi7344\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\18.17.1\cache\yarn\v6\npm-typescript-5.2.0-dev.20230807-652fa8a3fcc46958035d9b911c815299deb9f58e-integrity\node_modules\typescript\lib\pt-br\diagnosticMessages.generated.json’
— lsp_utils Node.js resolving end —
Unable to start subprocess for LSP-json
Traceback (most recent call last):
File “C:\Users\diakosi7344\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/windows.py”, line 248, in start_async
if plugin_class.needs_update_or_installation():
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils_client_handler\abstract_plugin.py”, line 101, in needs_update_or_installation
server = cls.get_server()
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\npm_client_handler.py”, line 130, in get_server
‘skip_npm_install’: cls.skip_npm_install,
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py”, line 47, in create
node_runtime = NodeRuntime.get(package_name, storage_path, required_node_version)
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\node_runtime.py”, line 58, in get
cls._node_runtime = cls._resolve_node_runtime(package_name, storage_path, required_semantic_version)
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\node_runtime.py”, line 125, in _resolve_node_runtime
raise Exception(‘Failed resolving Node.js Runtime. Please check in the console for more details.’)
Exception: Failed resolving Node.js Runtime. Please check in the console for more details.

0 Likes

#45

Renamed the node_runtime folder located in C:\Users\diakosi7344\AppData\Local\Sublime Text\Package Storage\lsp_utils after exiting ST4.
Restarted it and now it works as expected.

0 Likes

#46

Thanks. I can reproduce this. I think this is the culprit.

Step to reproduce:

  1. First use
{
    "nodejs_runtime": ["local"],
    "local_use_electron": true,
}
  1. After it’s working, now use
{
    "nodejs_runtime": ["local"],
    "local_use_electron": false,
}
  1. lsp_utils doesn’t switch to download node.js but emits an error.

The manual fix is to empty the Package Storage\lsp_utils\node-runtime directory.

0 Likes

#47

Exactly!
Do you want me to try again to verify that this is reproducible?

0 Likes

#48

No. I can reproduce that stably. An issue has been created on https://github.com/sublimelsp/lsp_utils/issues/109

1 Like

#49

That’s great!
I hope I wasn’t too much trouble in the end :slight_smile:

0 Likes

#50

A fix has been merged and will be in the next release.

  • Failed downloading: [WinError 3] The system cannot find the path specified: ‘C:\Users\diakosi7344\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\18.17.1\cache\yarn\v6\npm-typescript-5.2.0-dev.20230807-652fa8a3fcc46958035d9b911c815299deb9f58e-integrity\node_modules\typescript\lib\pt-br\diagnosticMessages.generated.json’

The root cause is the path is too long (>255 chars). The fix is to use its UNC form by prepending \\?\ to it. E.g., \\?\C:\Users\diakosi7344\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\18.17.1\cache\yarn\v6\npm-typescript-5.2.0-dev.20230807-652fa8a3fcc46958035d9b911c815299deb9f58e-integrity\node_modules\typescript\lib\pt-br\diagnosticMessages.generated.json.

2 Likes