Open cwrau opened 1 year ago
same problem
would be cool to see this feature implemented, it takes 1h30m to emerge it on gentoo machine the nodejs has gone so big over the time
i also have a similar issue where mason cant find the binary for node even though i have it installed through nvm and i have explicitly set it in the nvim path
Same issue here. I don't want to install npm
just to download a language server
I've been wanting to tackle the management of runtimes/compilers more holistically, but I guess it wouldn't hurt adding a node
package in the core registry, which would provide the node
, npm
, npx
, and corepack
executables.
I myself would rather go for the approach of detecting when npm isn't available, and not requesting mason to install packages that need it.
Please make this configurable. In my setup, I'd rather not have mason manage an npm install.
I ran into this problem yesterday. After probing around the core registry, Mason's config and the log, I've concluded that I needed to have the necessary tools installed on my machine.
I ended up getting around this issue by having a bash script that pretends to be the runtime tool (e.g. npm) and execute the command inside a container (node:20 for this example) instead.
I ended up getting around this issue by having a bash script that pretends to be the runtime tool (e.g. npm) and execute the command inside a container (node:20 for this example) instead.
Interesting, I've never thought about leveraging docker (opt-in) for hooking into external tooling
Interesting, I've never thought about leveraging docker (opt-in) for hooking into external tooling
Unfortunately, my journey wasn't as fruitful as I thought. Beyond installation, Mason stores the code on the host machine, which means when it comes to running the LSP server, it needs the necessary runtime engines as well.
Looking at nvim-lspconfig, there have been discussions on running the server inside a container by modifying the cmd
. Going down this route is bypassing Mason altogether, from what I can see.
That said, my experience with neovim (and lua) is non-existent (a couple of days). I don't know enough about this area to offer any directions.
Just chiming in that I ran into the same error message while working with Ubuntu on WSL.
Same issue here. I don't wanna install npm
in my notebook only for LSP...
I met the same issue.
Saying same thing doesn't add any value to this issue, author is already aware of it.
Same here, don't want to install npm :raised_hand_with_fingers_splayed: (I complain but I still install it... But I'd rather not. And thanks for your amazing work ;) )
Interesting, I've never thought about leveraging docker (opt-in) for hooking into external tooling
If you decide to do so, you must rely on unprivileged containers, which require the Linux kernel to be compiled with CONFIG_USER_NS (which is widely used nowadays but is very controversial because of the many security vulnerabilities found in it in past). Don't rely on privileged containers as it would obviously be a security risk, I'm pretty sure you don't sudo nvim
every time you have to edit something casually :-)
Pyright is written in Typescript, so its natural installation tool is npm
, but being a python tool its users are much more likely to have pip
installed on their computer than npm
.
There's actually already a community-maintained pypi package for Pyright which does exactly what the title above says: installing automatically npm.
I tried it with Mason and I confirm it was able to install pyright successfully.
@williamboman , would you welcome a PR that updates the registry in such a way? I think this would make the user experience of python developers smoother. The change is visible here: https://github.com/sv3ndk/mason-registry/blob/1e88de38fa008fa81270b675135983f6101a2245/packages/pyright/package.yaml#L13
That comment might be better as an issue on it's own.
@sv3ndk The pypi package won't be considered for addition to the core registry because:
1) it's not an official source 2) the way it's implemented is somewhat problematic imo. it's just a CLI wrapper around the Node package that installs Node & npm, installs the pyright npm package and then executes it as a subprocess, which introduces its own set of issues
I understand the convenience it provides for Python devs who don't touch Node and don't have it installed. I'd like to solve these external dependencies through mason.nvim so that you can manage runtimes as well (i.e. you'd be able to install Node through Mason). This would have to be done in a way that doesn't interfere with how people generally use Neovim with external runtime managers.
Ok, makes sense, thanks for the detailed feed-back
@williamboman Are there any updates on this?
I use a Manjaro distro, and two different Windows from Monday to Friday. Everything runs nice on Linux, but in Windows I am unable to install those ones
installation failed for package(name=html-lsp) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for package(name=vim-language-server) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for package(name=css-lsp) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for package(name=json-lsp) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for package(name=yaml-language-server) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for package(name=typescript-language-server) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for package(name=eslint-lsp) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
installation failed for Package(name=sqlls) error=spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
As the others said, I don't want to have any kind of node
related tech on any of my machines, (ye, I know that there's JS related lsp's, but from time to time I do code reviews) so I assume that if on Linux downloads and installs all the LSP correctly, it could be another way to deal with these failures that I am facing on Windows.
Maybe I miss something from the docs (or some other issue) where explains how could I use cargo
, wget
, curl
or whatever but npm
?
Thanks
I'm so frustrated right now, not because of this amazing library but with my OS. I have installed npm
and go
in my machine and I'm still having the same error:
[ERROR Thu 08 Feb 2024 12:16:49 PM -03] ...a/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=gopls) error=spawn: go failed with exit code - and signal -. go is not executable
[ERROR Thu 08 Feb 2024 12:43:42 PM -03] ...a/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=typescript-language-server) error=spawn: npm failed with exit code - and signal -. npm is not executable
I also tried with ThePrimeagen repo and I got the same error, to give you some information I want to tell you that I have installed neovim with flatpak in Pop-OS. I will try to install neovim globally and not inside a container and let you know.
Alright, after two days of frustration, my (skill issues) problem was fixed by installing the pre-built archives of nvim
to /otc/nvim/
and also installing npm
using nvm
. A little bit of background, flatpak
are containerized applications, that's good for many apps but no for nvim
, it cannot access to outside applications (that's the whole point of containerized applications, right?).
nvim
flatpak app.
flatpak uninstall io.neovim.nvim
nvm
from here.npm
using nvm
:
nvm install --lts
Also, I will also love not using npm
to use this library. Thanks.
Perhaps this could be "fixed" by adding an optional callback to the Mason API somewhere that triggers when a utility fails to install (or when the required libraries are not present).
This would allow other people, potentially a different package, to define the failure case, a few of which could be:
Perhaps this could be "fixed" by adding an optional callback to the Mason API somewhere that triggers when a utility fails to install (or when the required libraries are not present).
This would allow other people, potentially a different package, to define the failure case, a few of which could be:
* Install (and manage) that package manager (what this issue is requesting) * Error out (current behavior) * Do nothing but log the discrepancy. (what I'd like)
Also, I feel the idea complete if in the user configuration could live a little property to determine which managers to use (or to avoid completely), so it could be avoiding the error handling in case of failure and go straight to the user known managers, and, in any case, fallback to such callback
Same issue here. I don't want to install
npm
just to download a language server
so what are you doing to get lsp?
In my case, I'm simply not using lsp in those situations.
i also have a similar issue where mason cant find the binary for node even though i have it installed through nvm and i have explicitly set it in the nvim path
Did you ever figure this out. I am using asdf
and on the command line which npm
and npm
work fine, but mason is still not able to find it when it is trying to install these lsps.
Same issue here. I don't want to install
npm
just to download a language serverso what are you doing to get lsp?
I stopped using Mason and started using my system's package manager instead. https://archlinux.org/packages/extra/any/bash-language-server/ . Super easy to just yay bash-language-server
then add it to my configuration in lspconfig.lua
@sahinf how did u add it to lspconfig.lua?
@sahinf how did u add it to lspconfig.lua?
Probably the same as any other. I also feel like we're getting off-topic
I've searched open issues for similar requests
I've recently downloaded the latest plugin version of mason.nvim
Problem description
When installing packages that need to be installed with
npm
, the host has to havenpm
installed.I don't, as I don't work with that ecosystem.
Expected behavior
I'd like
mason
to be able to install it's own version of npm to use for this, so I don't have to pollute my host withnpm
.Affected packages
All npm packages
Mason output
Installation log
Neovim version (>= 0.7)
Operating system/version
Linux steve 6.2.13-zen-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Wed, 26 Apr 2023 20:49:44 +0000 x86_64 GNU/Linux
Healthcheck
Screenshots
No response