Skip to content

bug: "no such file or directory: 'pwsh'" on Windows #301

@sarahyack

Description

@sarahyack

Did you read the documentation and check existing issues?

Neovim version (nvim -v)

0.11.1

Operating system/version

Windows 10

Browser/version

Librewolf

Describe the bug

When I try to run :LivePreview start in my terminal, I get the error:


Error executing Lua callback: ...gram Files\Neovim\share\nvim\runtime/lua/vim/_system.lua:248: ENOENT: no such file or directory: "pwsh"
stack traceback:
	[C]: in function 'error'
	...gram Files\Neovim\share\nvim\runtime/lua/vim/_system.lua:248: in function 'spawn'
	...gram Files\Neovim\share\nvim\runtime/lua/vim/_system.lua:353: in function 'system'
	...nvim\plugged\live-preview.nvim/lua/livepreview/utils.lua:163: in function 'await_term_cmd'
	...nvim\plugged\live-preview.nvim/lua/livepreview/utils.lua:291: in function 'processes_listening_on_port'
	...\nvim\plugged\live-preview.nvim/lua/livepreview/init.lua:33: in function 'start'
	...al\nvim\plugged\live-preview.nvim\plugin\livepreview.lua:57: in function <...al\nvim\plugged\live-preview.nvim\plugin\livepreview.lua:28>

pwsh isn't a valid command to launch powershell on Windows 10 unles the user sets up an alias, as I found out to my dismay a while ago, 😄 . While the pwsh alias I do have works in my terminal to launch a new powershell instance, I guess it's not compatible with the plugin's process. Likely, it's just a simple fix to swap the references in the source code to powershell instead.

I have no configuration set, and saw no option to set the shell command, but perhaps there could be?

Steps To Reproduce

  1. Clone the plugin git clone https://github.com/brianhuster/live-preview.nvim
  2. Open Nvim with minimal repro file nvim -u minimal_init.lua
  3. ...

Expected Behavior

The command LivePreview start to open the server.

Health

==============================================================================
livepreview:                             require("livepreview.health").check()

Check dependencies ~
- ✅ OK Nvim 0.11.1 is compatible with Live Preview
- ✅ OK `powershell` is available
- ⚠️ WARNING `mini.pick` (optional) is not installed
- ✅ OK `telescope` is installed
- ⚠️ WARNING `fzf-lua` (optional) is not installed

Checkhealth server and process ~
- ✅ OK This Nvim process's PID is 3808
- ❌ ERROR Failed to run healthcheck for "livepreview" plugin. Exception:
  ...gram Files\Neovim\share\nvim\runtime/lua/vim/_system.lua:248: ENOENT: no such file or directory: "pwsh"

Minimal config to reproduce

vim.cmd.set "rtp+=/path/to/live-preview.nvim"

require("livepreview.config").set {
  --- Configuration here
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions