Multiple Packages Installation Fail
I've searched open issues for similar requests
- [X] Yes
I've recently downloaded the latest plugin version of mason.nvim
- [X] Yes
Problem description
Everything used to work fine until yesterday when I tried to replace basedpyright with pyright. After finding out pyright could not be install, I had try to fix the issue by removing and reinstalling Mason and all my language servers. The list below shows all the language servers I install:
- bashls
- clangd
- dotls
- hls
- jdtls
- jsonls
- lua_ls
- marksman
- pyright
- yamlls
The installations for pyright, bashls, dotls, jsonls, yamlls failed, but others are fine.
My machine does have node and npm, and npm install -g pyright works fine, therefore I assume there is something wrong with Mason.
Expected behavior
Successfully installing language servers.
Affected packages
pyright, bashls, dotls, jsonls, yamlls
Mason output
yaml-language-server
▼ Displaying full log
Wrote to /Users/yuhsienchiang/.local/share/nvim/mason/staging/yaml-language-server/package.json:
{
"name": "@mason/yaml-language-server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Initialized npm root.
Installing npm package [email protected]…
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/yaml-language-server failed, reason: unable to get local issuer certificate
npm ERR! A complete log of this run can be found in: /Users/yuhsienchiang/.npm/_logs/2024-04-02T05_01_48_222Z-debug-0.log
spawn: npm failed with exit code 1 and signal 0.
pyright
▼ Displaying full log
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in: /Users/yuhsienchiang/.npm/_logs/2024-04-02T05_00_37_271Z-debug-0.log
spawn: npm failed with exit code 1 and signal 0.
json-lsp
▼ Displaying full log
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/vscode-langservers-extracted failed, reason: unable to get local issuer certificate
npm ERR! A complete log of this run can be found in: /Users/yuhsienchiang/.npm/_logs/2024-04-02T05_00_37_274Z-debug-0.log
spawn: npm failed with exit code 1 and signal 0.
dot-language-server
▼ Displaying full log
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/dot-language-server failed, reason: unable to get local issuer certificate
npm ERR! A complete log of this run can be found in: /Users/yuhsienchiang/.npm/_logs/2024-04-02T05_00_37_265Z-debug-0.log
spawn: npm failed with exit code 1 and signal 0.
bash-language-server
▼ Displaying full log
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/bash-language-server failed, reason: unable to get local issuer certificate
npm ERR! A complete log of this run can be found in: /Users/yuhsienchiang/.npm/_logs/2024-04-02T05_00_37_266Z-debug-0.log
spawn: npm failed with exit code 1 and signal 0.
Installation log
[ERROR Tue 2 Apr 16:01:47 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=bash-language-server) error=spawn: npm failed with exit code 1 and signal 0.
[ERROR Tue 2 Apr 16:01:47 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=dot-language-server) error=spawn: npm failed with exit code 1 and signal 0.
[ERROR Tue 2 Apr 16:01:47 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=json-lsp) error=spawn: npm failed with exit code 1 and signal 0.
[ERROR Tue 2 Apr 16:01:47 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=pyright) error=spawn: npm failed with exit code 1 and signal 0.
[ERROR Tue 2 Apr 16:02:58 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=yaml-language-server) error=spawn: npm failed with exit code 1 and signal 0.
Neovim version (>= 0.7)
NVIM v0.9.5 Build type: Release LuaJIT 2.1.1710088188
Operating system/version
Darwin Yus-MacBook-Pro 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Healthcheck
mason: require("mason.health").check()
mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers:
mason.providers.registry-api
mason.providers.client
- OK neovim version >= 0.7.0
mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-04-02-jovial-cut` is installed.
mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send`
- OK wget: `GNU Wget 1.24.5 built on darwin23.2.0.`
- OK curl: `curl 8.4.0 (x86_64-apple-darwin23.0) libcurl/8.4.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.58.0`
- OK gzip: `Apple gzip 430.100.5`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)`
- OK sh: `Ok`
mason.nvim [Languages] ~
- WARNING Go: not available
- ADVICE:
- spawn: go failed with exit code - and signal -. go is not executable
- WARNING cargo: not available
- ADVICE:
- spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING luarocks: not available
- ADVICE:
- spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
- ADVICE:
- spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
- ADVICE:
- spawn: php failed with exit code - and signal -. php is not executable
- OK Ruby: `ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]`
- OK node: `v21.7.1`
- WARNING julia: not available
- ADVICE:
- spawn: julia failed with exit code - and signal -. julia is not executable
- OK java: `openjdk version "20.0.1" 2023-04-18`
- OK RubyGem: `3.0.3.1`
- OK python: `Python 3.10.12`
- OK javac: `javac 20.0.1`
- OK npm: `10.5.0`
- OK pip: `pip 24.0 from /Users/yuhsienchiang/.pyenv/versions/3.10.12/lib/python3.10/site-packages/pip (python 3.10)`
- OK python venv: `Ok`
mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Tue 2 Apr 16:43:15 2024.
Install and authenticate via gh-cli to increase rate limit.
Screenshots
No response
I met a similar issue to you. The following is from the MasonLog,
[ERROR Wed Apr 17 16:26:34 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=tailwindcss-language-server) error=spawn: npm failed with exit code 1 and signal 0.
[INFO Wed Apr 17 16:26:34 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=lua-language-server) {}
[ERROR Wed Apr 17 16:26:34 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=html-lsp) error=spawn: npm failed with exit code 1 and signal 0.
[INFO Wed Apr 17 16:26:34 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=graphql-language-service-cli) {}
[ERROR Wed Apr 17 16:26:34 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=css-lsp) error=spawn: npm failed with exit code 1 and signal 0.
But I can't find the log of Mason output e.g. under the folder /Users/<user_name>/.local/share/nvim/mason/staging/
Same issue. Tried enabling debug mode in mason, but ERROR message is no more informative.
[DEBUG Thu Apr 25 16:44:35 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 4168558
[DEBUG Thu Apr 25 16:44:35 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=4168558 exited with exit_code=1, signal=0
[DEBUG Thu Apr 25 16:44:35 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:59: fs: unlink /home/devd/.local/share/nvim/mason/staging/pyright.lock
[DEBUG Thu Apr 25 16:44:35 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:47: fs: rmrf /home/devd/.local/share/nvim/mason/staging/pyright
[DEBUG Thu Apr 25 16:44:35 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:39: Building receipt for Package(name=pyright)
[ERROR Thu Apr 25 16:44:35 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=pyright) error=spawn: npm failed with exit code 1 and signal 0.
Healthcheck
- OK mason.nvim version v1.10.0
- OK PATH: skip
- OK Providers:
mason.providers.registry-api
mason.providers.client
- OK neovim version >= 0.7.0
mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-04-25-cleaver-mitten` is installed.
mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send`
- OK wget: `GNU Wget 1.21.1 built on linux-gnu.`
- OK curl: `curl 8.6.0 (x86_64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/1.1.1k-fips zlib/1.2.11 zstd/1.4.4 libidn2/2.2.0 libpsl/0.20.2 nghttp2/1.43.0`
- OK gzip: `gzip 1.9`
- OK gtar: `tar (GNU tar) 1.30`
- OK bash: `GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)`
- OK sh: `Ok`
mason.nvim [Languages] ~
- WARNING cargo: not available
- ADVICE:
- spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING Composer: not available
- ADVICE:
- spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
- ADVICE:
- spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
- ADVICE:
- spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- OK Ruby: `ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]`
- OK node: `v20.10.0`
- OK Go: `go version go1.22.1 linux/amd64`
- WARNING julia: not available
- ADVICE:
- spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.11.6`
- OK RubyGem: `2.7.6.3`
- OK java: `openjdk version "1.8.0_362"`
- OK javac: `Ok`
- OK npm: `10.2.3`
- OK pip: `pip 23.3.1 from /app/vbuild/RHEL8-x86_64/python/3.11-addons-pip-23.3.1/lib/python3.11/site-packages/pip (python 3.11)`
- OK python venv: `Ok`
Figured out! It was due to proxy. I ran the below command outside nvim,
npm install pyright and it clearly showed me the error :)
I've encountered it and solved it, you guys can refer to it.
- I changed the .npm file registry, and when I restored the defaults, the error code became 243.
- Executing npm install XXX in the terminal prompted me to execute the following command, at which point my npm worked fine
sudo chown -R 501:20 $HOME/.npm