Mason unable to locate npm executable

Hey everyone,

I’m encountering a problem with Mason in Neovim. Each time I launch it, I get an error notification in the Mason logs:

[INFO 7/23/2025 19:36:13] ...mason.nvim/lua/mason-core/installer/PackageInstaller.lua:45: Running installer for Package(name=eslint) {
  debug = false,
  force = false,
  strict = false
}

[ERROR 7/23/2025 19:36:14] ...nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:225: Process spawn failed. cmd="C:\\Program Files\\nodejs\\npm", err="ENOENT: no such file or directory"

[ERROR 7/23/2025 19:36:14] ...mason.nvim/lua/mason-core/installer/PackageInstaller.lua:98: Package installation failed Package(name=eslint) error=spawn: npm failed with exit code - and signal -. Executable "C:\\Program Files\\nodejs\\npm" not found in PATH.

However, when I check for npm’s location directly, it appears to be there:

:!"where npm"

C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd

Does anyone have any insight into what this problem might be?

Mason’s hardcoded to look for the bare executable name without the .cmd extension on Windows. Quick fix: copy npm.cmd in your nodejs directory and rename it to just ‘npm’ (no extension). Go to C:\Program Files\nodejs, duplicate npm.cmd, then rename the copy to npm. This fixes the ENOENT error since Mason will find what it’s looking for. I hit this same issue on a fresh Windows install and this workaround works every time. Just run your terminal as admin when making the copy so you don’t get permission errors.

windows issue - mason looks for npm.exe but node installs npm.cmd by default. try setting vim.fn.executable('npm.cmd') in your config or make a symlink from npm to npm.cmd in your nodejs folder. had the same problem last month.

It seems that Mason is trying to access npm directly, which can lead to issues on Windows since the executable is typically named npm.cmd. You’ll want to verify that your PATH environment variable correctly points to the Node.js installation directory. If the path is correct and you’re still facing the issue, consider reinstalling Node.js as the installer updates your PATH variables automatically. Alternatively, using a version manager like nvm-windows can provide better control over installations and environments.