sublimelsp / lsp_utils

Module with LSP-related utilities for Sublime Text
https://sublimelsp.github.io/lsp_utils/
MIT License
16 stars 6 forks source link

Failed deleting local Electron runtime due to long path on Windows #109

Closed jfcherng closed 1 year ago

jfcherng commented 1 year ago

Steps for reproduction

On Windows,

  1. Use the following settings and restart ST.
{
    "nodejs_runtime": ["local"],
    "local_use_electron": true,
}

This forces lsp_utils to download Electron and use it. Everything works fine.

  1. Now, use the following settings and restart ST.
{
    "nodejs_runtime": ["local"],
    "local_use_electron": false,
}

This should ask lsp_utils to download Node.js. But after restarting ST, I get

[lsp_utils] Deleting outdated Node.js runtime directory "C:\Users\jfcherng\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] File not found: 'C:\\Users\\jfcherng\\AppData\\Local\\Sublime Text\\Package Storage\\lsp_utils\\node-runtime\\18.17.1\\cache\\yarn\\v6\\npm-copilot-node-server-1.11.0-7eed36a428960e570c06cff8ccd86d70450cacdf-integrity\\node_modules\\copilot-node-server\\copilot\\dist\\compiled\\darwin\\arm64\\kerberos.node'
--- lsp_utils Node.js resolving end ---
Unable to start subprocess for LSP-json
Traceback (most recent call last):
  File "C:\Users\jfcherng\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\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\lsp_utils\_client_handler\abstract_plugin.py", line 101, in needs_update_or_installation
    server = cls.get_server()
  File "C:\Users\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\lsp_utils\npm_client_handler.py", line 130, in get_server
    'skip_npm_install': cls.skip_npm_install,
  File "C:\Users\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\lsp_utils\server_npm_resource.py", line 47, in create
    node_runtime = NodeRuntime.get(package_name, storage_path, required_node_version)
  File "C:\Users\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\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\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\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.

reloading python 3.3 plugin AutomaticPackageReloader33.package_reloader
Unable to start subprocess for LSP-copilot
Traceback (most recent call last):
  File "C:\Users\jfcherng\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\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\lsp_utils\_client_handler\abstract_plugin.py", line 101, in needs_update_or_installation
    server = cls.get_server()
  File "C:\Users\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\lsp_utils\npm_client_handler.py", line 130, in get_server
    'skip_npm_install': cls.skip_npm_install,
  File "C:\Users\jfcherng\AppData\Roaming\Sublime Text\Lib\python33\lsp_utils\server_npm_resource.py", line 49, in create
    raise Exception('Failed resolving Node.js Runtime. Please see Sublime Text console for more information.')
Exception: Failed resolving Node.js Runtime. Please see Sublime Text console for more information.

The path to be deleted is more than 255-char long. C:\Users\jfcherng\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\18.17.1\cache\yarn\v6\npm-copilot-node-server-1.11.0-7eed36a428960e570c06cff8ccd86d70450cacdf-integrity\node_modules\copilot-node-server\copilot\dist\compiled\darwin\arm64\kerberos.node

References