nvim-lua/plenary.nvim

Failed to spawn process, ENOENT: no such file or directory

faileon opened this issue · 2 comments

Hi everyone, I have the following code:

local Job = require "plenary.job"
Job:new({
  "npm",
  "info",
  "anuglar",
  "versions",
  "--json",
  on_exit = function(job)
    local result = job:result()
    print(vim.inspect(result))
  end,
}):start()

But it throws the following exception:

Failed to spawn process: {
  _additional_on_exit_callbacks = {},
  _shutdown_check = <userdata 1>,
  _stderr_results = {},
  _stdout_results = {},
  _user_on_exit = <function 1>,
  args = { "info", "anuglar", "versions", "--json" },
  command = "npm",
  enable_handlers = true,
  enable_recording = true,
  interactive = true,
  pid = "ENOENT: no such file or directory",
  stderr = <userdata 2>,
  stdin = <userdata 3>,
  stdout = <userdata 4>,
  user_data = {},
}

My initial hunch was that NPM is not present in path, but it is. I can run the same command in terminal and I also verified the output of $env:PATH that nodejs and npm is present. I have also verified that vim sees the correct paths with vim.inspect(vim.env.PATH), which contains C:\\Program Files\\nodejs;, which is the location of my nodejs and npm .

My plenary version is latest at this moment i.e. 4f71c0c
Neovim version v0.9.5
OS: Microsoft Windows 11 Pro - 10.0.22631 N/A Build 22631

I think it might be windows related issue? Anyone have a clue please?