mason.nvim
mason.nvim copied to clipboard
Can't find absolute path to `npm` executable on PATH (Windows)
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
Not 100% sure when this started occurring, but I just noticed this after updating node (installed via scoop). mason healthcheck reports being unable to find the absolute path to the npm executable in $PATH. The absolute path C:/Users/me/scoop/apps/nodejs/current/npm is NOT in $PATH, but the parent directory (C:/Users/me/scoop/apps/nodejs/current) is.
> which npm && where npm
/c/Users/me/scoop/apps/nodejs/current/npm
C:\Users\me\scoop\apps\nodejs\current\npm
C:\Users\me\scoop\apps\nodejs\current\npm.cmd
I think it's due to this change: https://github.com/mason-org/mason.nvim/pull/1885
Expected behavior
Mason correctly finds the npm executable
Steps to reproduce
- Install
npmviascoop install nodejs - run
:checkhealth mason
Neovim version (>= 0.10.0)
NVIM v0.11.1 Build type: Release LuaJIT 2.1.1741730670
Operating system/version
Windows 11
Healthcheck output
==============================================================================
mason: require("mason.health").check()
mason.nvim ~
- ✅ OK mason.nvim version v2.0.0
- ✅ OK PATH: prepend
- ✅ OK Providers:
mason.providers.registry-api
mason.providers.client
- ✅ OK neovim version >= 0.10.0
mason.nvim [Registries] ~
- ✅ OK Registry `github.com/mason-org/mason-registry version: 2025-05-22-hearty-tapir` 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.4 built on mingw32.
`
- ✅ OK curl: `curl 8.12.1 (Windows) libcurl/8.12.1 Schannel zlib/1.3 WinIDN
`
- ✅ OK gzip: `gzip 1.13`
- ✅ OK tar: `tar (GNU tar) 1.35`
- ✅ OK pwsh: `7.5.1 Microsoft Windows 10.0.22631 Win32NT
`
- ✅ OK 7z: `7-Zip 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29
`
mason.nvim [Languages] ~
- ⚠️ WARNING Ruby: not available
- ADVICE:
- spawn: ruby failed with exit code - and signal -. Could not find executable "ruby" in PATH.
- ⚠️ WARNING Composer: not available
- ADVICE:
- spawn: composer failed with exit code - and signal -. Could not find executable "composer" in PATH.
- ⚠️ WARNING PHP: not available
- ADVICE:
- spawn: php failed with exit code - and signal -. Could not find executable "php" in PATH.
- ⚠️ WARNING npm: not available
- ADVICE:
- spawn: npm failed with exit code - and signal -. Could not find executable "C:/Users/me/scoop/apps/nodejs/current/npm" in PATH.
- ⚠️ WARNING RubyGem: not available
- ADVICE:
- spawn: gem failed with exit code - and signal -. Could not find executable "gem" in PATH.
- ⚠️ WARNING javac: not available
- ADVICE:
- spawn: javac failed with exit code - and signal -. Could not find executable "javac" in PATH.
- ⚠️ WARNING java: not available
- ADVICE:
- spawn: java failed with exit code - and signal -. Could not find executable "java" in PATH.
- ✅ OK cargo: `cargo 1.87.0 (99624be96 2025-05-06)`
- ✅ OK luarocks: `luarocks 3.11.1
`
- ✅ OK Go: `go version go1.24.3 windows/amd64`
- ✅ OK node: `v24.1.0
`
- ✅ OK python: `Python 3.10.14
`
- ✅ OK julia: `julia version 1.11.5`
- ✅ OK pip: `pip 24.0 from C:\Users\me\AppData\Local\miniforge3\lib\site-packages\pip (python 3.10)
`
- ✅ OK python venv: `Ok`
Screenshots
No response
just came to say im getting this error aswell when trying to install pyright
Same issue too, can't install or run any package that uses npm in Windows
TEMP FIX
for those who still get this. i worked around it to install what i needed in the following way. as @nataziel said they think it has to do with the commit #1885 so i just
- revert mason to the commit right before in lazy config using
commit = "2fca788", - restart neovim, open lazy and update mason to pull the commit we just set
- restart again, open mason and install what you need.
- remove commit spec and reupdate mason plugin in lazy to latest.
Thanks so much, it worked!
TEMP FIX
for those who still get this. i worked around it to install what i needed in the following way. as @nataziel said they think it has to do with the commit #1885 so i just
* revert mason to the commit right before in lazy config using `commit = "2fca788",` * restart neovim, open lazy and update mason to pull the commit we just set * restart again, open mason and install what you need. * remove commit spec and reupdate mason plugin in lazy to latest.
Thanks so much, wasted almost 2 hrs, and cursed windows and chatgpt for all the fixes, but this worked.
Hello! In neovim, what's your :echo &shell and echo $PATHEXT values? Are you running neovim inside WSL somehow?
Having this issue as well, using git bash in windows, not WSL.
echo &shell gives bash
echo $PATHTEXT gives nothing
echo $PATH gives my path
This has not been a problem until updating mason.
EDIT: Should also mention that this problem specifically DOES NOT occur in WSL.
Thanks. The problem is that Neovim detects you're using a unix shell (bash) and then assumes that any file inside a directory in PATH is executable if there's a match. Could you confirm the issue disappears if you :set shell=powershell or :set shell=pwsh and then attempt to do the installation in Mason?
:echo &shell -> C:\Users\me/AppData/Local/Programs/Git/usr/bin/bash.exe
:echo $PATHEXT -> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
:set shell=powershell does appear to fix the problem
Thanks! Would you be able to try out https://github.com/mason-org/mason.nvim/pull/1991 (branch fix/windows-exepath-unix-shell) and see if that fixes it (you don't have to manually :set shell=powershell)?
I was able to install a linter requiring npm after getting mason (via lazy) to point directly to that branch/commit. Unfortunately I don't currently have anything requiring an update but looking at the code it seems like it should act the same in both cases.