-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
LspInstall for pyright and intelephense fails when node packages are installed with the same name as the plugin #467
Comments
I'm not sure I understand this bug. If pyright is already installed, and you call :LspInstall pyright it fails? |
Pyright/intelephense are not installed. If they would be installed, LspInstall would tell it and refuse to go on. The LspInstall command creates a folder called “pyright”, puts a package.json in there with the name “pyright” and tries to install the module “pyright” in this I guess. Npm then refuses to do this. |
Does |
When I install pyright manually via npm, then LSP does not work here. This is what
The folder |
It doesn't matter where pyright is installed so long as it is in your path. LspInstallInfo just uses the built-in installer directory to check if pyright was installed via LspInstall (not that it's actually present) so this would be a false negative, but you can install pyright as a global npm package and it will work (no symlink required) |
All right. So even when it is installed, I’m missing the LSP features. Is there some log or health info to see what’s wrong? |
Are you using node15? There's a tracking issue and PR to workaround node 15 issues if you look in the tracker. To get logs you can add |
@mjlbach thanks for the hint, I'm using node I had a look at the lsp.log and found this:
There is also an issue for this bug (which is all linked to the node15 bug I think). I replace my local file |
Yep! You can follow that issue and pr for updates. |
@mjlbach I have the same issue as the OP. The ensuing discussion didn't address the initial problem, so I think it's worth re-opening this issue. To reiterate, Node will not install a dependency which has the same name as the package into which it's being installed. An example may help to clarify this statement. Assume you have the following { "name": "intelephense" } In this case, Unfortunately, this is exactly what {
"name": "intelephense",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
} This seems like a bug in the behaviour of |
Yes, that's true (I realize I just helped OP workaround the built-in installer). Have you seen the pinned issue? #334 These installers are likely being removed soon. There are a ton of issues with the built-in installers, as evidenced by a large number of bug reports ultimately being related to failing installers, and windows support is spotty at best. |
Do you want to try #476? |
Whoops ignore, wrong fix |
I don't think there's official advice/general policy, but my gut would be that PRs will be merged that fix LspInstall but that generally it will be more in-line with future recommendations to allow your system package manager to handle install of servers. FWIW, I use nix for this, and only ever debug LspInstall on behalf of others. |
Does that mean you manually spin up the relevant Language Servers outside of Neovim, so that the Neovim LSP client can connect to them? Sorry if that's a dumb question; I'm a little unclear as to what I need to do manually, and what this plugin takes care of automatically. |
No, neovim will launch the language server for you. What is planning to be removed is the installer (so LspInstall and LspInstallInfo). So long as the language server is on your path, everything will work as it does currently. |
Got it. Thanks for the clarification. |
Closed by #498 |
nvim --version
: v0.5.0-dev+950-g5ce328df4:checkhealth
result: https://dpaste.com/9PFATQ2MA$TERM
: xterm-256colorHow to reproduce the problem from neovim startup
Execute
:LspInstall pyright
or:LspInstall intelephense
.Actual behaviour
The following error is printed (reformatted because its broken):
The same happens when installing
intelephense
. Looking in the/Users/robin/.cache/nvim/lspconfig/pyright
folder (which is created by the LspInstall command), there is a package.json with the following content:Running a
npm install pyright
here fails because the package name can't have the same name as the dependency I think. Executing:LspInstall tsserver
works here, because the actual package which is installed is calledtypescript-language-server
and therefore has a different name than the folder.The text was updated successfully, but these errors were encountered: