Sublime Forum

ST4: LSP fails to install (any) language server

#17

I would suggest just use lsp_utils-managed env then.

0 Likes

#18

That is fine with me but … if you mean to change system to local then that has broken too for some reason. It worked when I first faced this issue but after Package Control got an update I saw the same problem appear again!

0 Likes

#19

No error msg is post though.

0 Likes

#20

It’s the same as the one I posted above. I am attaching it here again (the NodeJS version used is a fresh one now as stated before).

[lsp_utils] START output of command: “ci --omit=dev --scripts-prepend-node-path=true --verbose”

[lsp_utils] Command output END
Unable to start subprocess for LSP-json
Traceback (most recent call last):
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py”, line 123, in install_or_update
self._node_runtime.run_install(cwd=self._server_dest)
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\node_runtime.py”, line 217, in run_install
raise Exception(‘Failed to run npm command “{}”:\n{}’.format(’ '.join(args), error))
Exception: Failed to run npm command “ci --omit=dev --scripts-prepend-node-path=true --verbose”:
npm verb cli C:\Program Files\nodejs\20_9\node.exe C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm info using npm@10.2.1
npm info using node@v20.9.0
npm verb title npm ci
npm verb argv “ci” “–omit” “dev” “–scripts-prepend-node-path” “true” “–loglevel” “verbose”
npm verb logfile logs-max:10 dir:C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T16_25_19_145Z-
npm verb logfile C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T16_25_19_145Z-debug-0.log
npm verb loadVirtual Error: loadVirtual requires existing shrinkwrap file
npm verb loadVirtual at Arborist.loadVirtual (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\load-virtual.js:51:18)
npm verb loadVirtual at async CI.exec (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js:48:5)
npm verb loadVirtual at async module.exports (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\cli-entry.js:61:5)
npm verb stack Error:
npm verb stack The npm ci command can only install with an existing package-lock.json or
npm verb stack npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm verb stack later to generate a package-lock.json file, then try again.
npm verb stack
npm verb stack Clean install a project
npm verb stack
npm verb stack Usage:
npm verb stack npm ci
npm verb stack
npm verb stack Options:
npm verb stack [–install-strategy <hoisted|nested|shallow|linked>] [–legacy-bundling]
npm verb stack [–global-style] [–omit <dev|optional|peer> [–omit <dev|optional|peer> …]]
npm verb stack [–include <prod|dev|optional|peer> [–include <prod|dev|optional|peer> …]]
npm verb stack [–strict-peer-deps] [–foreground-scripts] [–ignore-scripts] [–no-audit]
npm verb stack [–no-bin-links] [–no-fund] [–dry-run]
npm verb stack [-w|–workspace [-w|–workspace …]]
npm verb stack [-ws|–workspaces] [–include-workspace-root] [–install-links]
npm verb stack
npm verb stack aliases: clean-install, ic, install-clean, isntall-clean
npm verb stack
npm verb stack Run “npm help ci” for more info
npm verb stack at CI.usageError (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\base-command.js:113:26)
npm verb stack at C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js:54:18
npm verb stack at async CI.exec (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js:48:5)
npm verb stack at async module.exports (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\cli-entry.js:61:5)
npm verb cwd C:\Users\diakosi7344
npm verb Windows_NT 10.0.22621
npm verb node v20.9.0
npm verb npm v10.2.1
npm ERR! code EUSAGE
npm ERR!
npm ERR! The npm ci command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [–install-strategy <hoisted|nested|shallow|linked>] [–legacy-bundling]
npm ERR! [–global-style] [–omit <dev|optional|peer> [–omit <dev|optional|peer> …]]
npm ERR! [–include <prod|dev|optional|peer> [–include <prod|dev|optional|peer> …]]
npm ERR! [–strict-peer-deps] [–foreground-scripts] [–ignore-scripts] [–no-audit]
npm ERR! [–no-bin-links] [–no-fund] [–dry-run]
npm ERR! [-w|–workspace [-w|–workspace …]]
npm ERR! [-ws|–workspaces] [–include-workspace-root] [–install-links]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run “npm help ci” for more info
npm verb exit 1
npm verb code 1

npm ERR! A complete log of this run can be found in: C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T16_25_19_145Z-debug-0.log

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\diakosi7344\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/windows.py”, line 250, in start_async
plugin_class.install_or_update()
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils_client_handler\abstract_plugin.py”, line 109, in install_or_update
server.install_or_update()
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py”, line 127, in install_or_update
raise Exception(‘Error installing the server:\n{}’.format(error))
Exception: Error installing the server:
Failed to run npm command “ci --omit=dev --scripts-prepend-node-path=true --verbose”:
npm verb cli C:\Program Files\nodejs\20_9\node.exe C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm info using npm@10.2.1
npm info using node@v20.9.0
npm verb title npm ci
npm verb argv “ci” “–omit” “dev” “–scripts-prepend-node-path” “true” “–loglevel” “verbose”
npm verb logfile logs-max:10 dir:C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T16_25_19_145Z-
npm verb logfile C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T16_25_19_145Z-debug-0.log
npm verb loadVirtual Error: loadVirtual requires existing shrinkwrap file
npm verb loadVirtual at Arborist.loadVirtual (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\load-virtual.js:51:18)
npm verb loadVirtual at async CI.exec (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js:48:5)
npm verb loadVirtual at async module.exports (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\cli-entry.js:61:5)
npm verb stack Error:
npm verb stack The npm ci command can only install with an existing package-lock.json or
npm verb stack npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm verb stack later to generate a package-lock.json file, then try again.
npm verb stack
npm verb stack Clean install a project
npm verb stack
npm verb stack Usage:
npm verb stack npm ci
npm verb stack
npm verb stack Options:
npm verb stack [–install-strategy <hoisted|nested|shallow|linked>] [–legacy-bundling]
npm verb stack [–global-style] [–omit <dev|optional|peer> [–omit <dev|optional|peer> …]]
npm verb stack [–include <prod|dev|optional|peer> [–include <prod|dev|optional|peer> …]]
npm verb stack [–strict-peer-deps] [–foreground-scripts] [–ignore-scripts] [–no-audit]
npm verb stack [–no-bin-links] [–no-fund] [–dry-run]
npm verb stack [-w|–workspace [-w|–workspace …]]
npm verb stack [-ws|–workspaces] [–include-workspace-root] [–install-links]
npm verb stack
npm verb stack aliases: clean-install, ic, install-clean, isntall-clean
npm verb stack
npm verb stack Run “npm help ci” for more info
npm verb stack at CI.usageError (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\base-command.js:113:26)
npm verb stack at C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js:54:18
npm verb stack at async CI.exec (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js:48:5)
npm verb stack at async module.exports (C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\cli-entry.js:61:5)
npm verb cwd C:\Users\diakosi7344
npm verb Windows_NT 10.0.22621
npm verb node v20.9.0
npm verb npm v10.2.1
npm ERR! code EUSAGE
npm ERR!
npm ERR! The npm ci command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [–install-strategy <hoisted|nested|shallow|linked>] [–legacy-bundling]
npm ERR! [–global-style] [–omit <dev|optional|peer> [–omit <dev|optional|peer> …]]
npm ERR! [–include <prod|dev|optional|peer> [–include <prod|dev|optional|peer> …]]
npm ERR! [–strict-peer-deps] [–foreground-scripts] [–ignore-scripts] [–no-audit]
npm ERR! [–no-bin-links] [–no-fund] [–dry-run]
npm ERR! [-w|–workspace [-w|–workspace …]]
npm ERR! [-ws|–workspaces] [–include-workspace-root] [–install-links]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run “npm help ci” for more info
npm verb exit 1
npm verb code 1

npm ERR! A complete log of this run can be found in: C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T16_25_19_145Z-debug-0.log

0 Likes

#21

This doesn’t use npm managed by lsp_utils. It uses C:\Users\diakosi7344\AppData\Roaming\npm\node_modules\npm\lib\commands\ci.js

0 Likes

#22

Sorry I notice an typo in my previous post.

What if you change lsp_utils settings to

{
    // 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", "system"],
    "local_use_electron": false,
}

This should use lsp_utils-managed one.

0 Likes

#23

As stated in the above posts:

  • I tried this suggestion at first and it worked.
  • After some days, Package Manager got auto-updated.
  • As such the error appeared again.

I am trying to see if something is wrong with my environment variables after having removed nvm.
I also forced deleted anything in the npm cache (and verified) by doing:

  • npm cache clean --force
  • npm cache verify

I will get back to you to see if I have progressed any further. Please bear with me :slight_smile:

0 Likes

#24

In case you didn’t notice, this settings is not what I post, I’ve modified it. So I am not sure whether " * I tried this suggestion at first and it worked." still apply here. At least I still doesn’t see an error log for lsp_utils-managed env.

0 Likes

#25

My apologies.
Where can I find that log then?

In the meantime, I tidied up my environment variables (removed any invalid references to NodeJS and npm), removed the NMV installer (just to be safe), removed NodeJS and ST4 and removed all relevant ST4 and NodeJS / NPM data in Roaming and Local directories.
Rebooted at every step.

I installed everything but now I get this: image

It’s not my day is it? :stuck_out_tongue:

0 Likes

#26

Just like those you post before. But what I am interested in is log for lsp_utils-managed env but not your own.

That is, use settings in ST4: LSP fails to install (any) language server and post error log where you can find in ST console just like before.

Or even more aggressive, just "nodejs_runtime": ["local"], so it probably never uses a system one.

0 Likes

#27

I am sorry but I do not follow.
That is the only log I get from ST4 as stated. Do you want the whole file to be attached?

I did change it now after the whole nuke thing but it is not apparent to me where system is expected to reside and where local is expected to reside. Is there any relevant documentation where this is explained?
I expect system to be in C:/Program Files/nodejs but local in %USERPROFILE%? Previously when I used the local it installed all those LSP NPM packages within the project folder. Maybe that broke it again after Package Control got auto-upgraded? Now it works but I do not understand where local points to. A bit confused in that part.

Sorry for being a pain in the a** but these thing has created all sorts of problems for me :stuck_out_tongue:

0 Likes

#28

“local” installs node.js in C:\Users\jfcherng\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime, where jfcherng is my username.

0 Likes

#29

Also, the popup occurs because I had a package-lock.json file there. This is what caused the crash but I removed it and then got this:

[lsp_utils] START output of command: “ci --omit=dev --scripts-prepend-node-path=true --verbose”

[lsp_utils] Command output END
Unable to start subprocess for LSP-json
Traceback (most recent call last):
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py”, line 123, in install_or_update
self._node_runtime.run_install(cwd=self._server_dest)
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\node_runtime.py”, line 217, in run_install
raise Exception(‘Failed to run npm command “{}”:\n{}’.format(’ '.join(args), error))
Exception: Failed to run npm command “ci --omit=dev --scripts-prepend-node-path=true --verbose”:
npm verb cli C:\Program Files\nodejs\20_9\node.exe C:\Program Files\nodejs\20_9\node_modules\npm\bin\npm-cli.js
npm info using npm@10.1.0
npm info using node@v20.9.0
npm verb title npm ci
npm verb argv “ci” “–omit” “dev” “–scripts-prepend-node-path” “true” “–loglevel” “verbose”
npm verb logfile logs-max:10 dir:C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T17_18_01_818Z-
npm verb logfile C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T17_18_01_818Z-debug-0.log
npm verb stack Error: ENOENT: no such file or directory, open ‘C:\Users\diakosi7344\package.json’
npm verb cwd C:\Users\diakosi7344
npm verb Windows_NT 10.0.22621
npm verb node v20.9.0
npm verb npm v10.1.0
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\diakosi7344/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ‘C:\Users\diakosi7344\package.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm verb exit -4058
npm verb code -4058

npm ERR! A complete log of this run can be found in: C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T17_18_01_818Z-debug-0.log

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\diakosi7344\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/windows.py”, line 250, in start_async
plugin_class.install_or_update()
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils_client_handler\abstract_plugin.py”, line 109, in install_or_update
server.install_or_update()
File “C:\Users\DIAKOS~1\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_npm_resource.py”, line 127, in install_or_update
raise Exception(‘Error installing the server:\n{}’.format(error))
Exception: Error installing the server:
Failed to run npm command “ci --omit=dev --scripts-prepend-node-path=true --verbose”:
npm verb cli C:\Program Files\nodejs\20_9\node.exe C:\Program Files\nodejs\20_9\node_modules\npm\bin\npm-cli.js
npm info using npm@10.1.0
npm info using node@v20.9.0
npm verb title npm ci
npm verb argv “ci” “–omit” “dev” “–scripts-prepend-node-path” “true” “–loglevel” “verbose”
npm verb logfile logs-max:10 dir:C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T17_18_01_818Z-
npm verb logfile C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T17_18_01_818Z-debug-0.log
npm verb stack Error: ENOENT: no such file or directory, open ‘C:\Users\diakosi7344\package.json’
npm verb cwd C:\Users\diakosi7344
npm verb Windows_NT 10.0.22621
npm verb node v20.9.0
npm verb npm v10.1.0
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\diakosi7344/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ‘C:\Users\diakosi7344\package.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm verb exit -4058
npm verb code -4058

npm ERR! A complete log of this run can be found in: C:\Users\diakosi7344\AppData\Local\npm-cache_logs\2023-10-25T17_18_01_818Z-debug-0.log

Notice that now it expects a package.json in %USERPROFILE% (aka C:\Users\diakosi7344/)
Then, I tried using local again to see if it would work and thank God it did. However, the whole setup seems flaky with all those errors and popup crashes :smiley: (no offence meant).

All the LSP packages I installed expect it there? However, I don’t see now any node_modules folder or any package-lock.json file or package.json file.

0 Likes

#30

In short:

  • nvm does not play well with ST4
  • environment variables should be tidied up in case of deduplicated vars (so npm in user env PATH and nodejs in SYS env path)
  • package-lock.json file may cause LSP to loop and crash (reproducible)
0 Likes

#31

Ah perfect! That’s very useful! Thanks! :slight_smile:

I can confirm I have a node_runtime in C:\Users\diakosi7344\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\18.18.1\node and the LSP-* stuff are finally working.

Hopefully, they do not break again! :crossed_fingers:

0 Likes

#32

Uh… so what you did to make it work?

0 Likes

#33
  • I removed nvm NodeJS installations and removed nvm too.
  • Removed NVM env vars and any old vars related to NodeJS.
  • Installed NodeJS and verified env vars are correct (used a Windows Sandbox to verify this).
  • Nuked ST4 and Sublime Merge and all AppData related folders in that dir and reinstalled

I had to reboot between all these steps just to be safe.

0 Likes

#34

That’s… quite a lot. Ideally I would like to see an error log when using

{
    // 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,
}

with whatever your user environment (e.g., with NVM installed).


But I guess you are tired of trying these things so :man_shrugging: whatever works.

0 Likes

#35

The error I got says there are logs in C:\Users\diakosi7344\AppData\Local\npm-cache_logs. Do you want me to go through that folder and look for a … lsp_utils-managed.log file? Can you be more specific please?

0 Likes

#36

I would like to first make sure “local” npm is used rather than the system one.

0 Likes