williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.22k stars 258 forks source link

Packages installed using PowerShell & pwsh (on Windows) cause an error #1739

Open thomastan opened 1 week ago

thomastan commented 1 week ago

I've searched open issues for similar requests

I've recently downloaded the latest plugin version of mason.nvim

Problem description

I'm getting the following error from installs made by PowerShell. Happens with both powershell and pwsh:

Stop : The term 'Stop' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:26
+ $ErrorActionPreference = Stop; $ProgressPreference = 'SilentlyContinu ...
+                          ~~~~
    + CategoryInfo          : ObjectNotFound: (Stop:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I tried Mason's commands manually in both powershell and pwsh and got the same error message:

(PowerShell):

sshot1-powershell

(pwsh):

sshot2-pwsh

PowerShell version: 5.1.22621.2506 pwsh (PowerShell Core) version: 7.4.3

Expected behavior

Installation of packages without error.

Affected packages

All

Mason output

Stop : The term 'Stop' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
        the spelling of the name, or if a path was included, verify that the path is correct and try again.
        At line:1 char:26
        + $ErrorActionPreference = Stop; $ProgressPreference = 'SilentlyContinu ...
        +                          ~~~~
            + CategoryInfo          : ObjectNotFound: (Stop:String) [], CommandNotFoundException
            + FullyQualifiedErrorId : CommandNotFoundException

### Installation log

```Text
[INFO  6/21/2024 3:06:27 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=codelldb) {}
[DEBUG 6/21/2024 3:06:27 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:58: Attempting to lock package Package(name=codelldb)
[DEBUG 6/21/2024 3:06:27 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:70: Wrote lockfile Package(name=codelldb)
[DEBUG 6/21/2024 3:06:27 PM] ...cal/data/nvim-data/lazy/mason.nvim/lua/mason-core/fs.lua:71: fs: mkdirp C:\Users\thomastan\.local\data\nvim-data\mason\staging\codelldb
[DEBUG 6/21/2024 3:06:27 PM] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:149: Compiling installer. codelldb {}
[DEBUG 6/21/2024 3:06:27 PM] ...azy/mason.nvim/lua/mason-core/installer/managers/std.lua:96: std: downloading file "https://github.com/vadimcn/vscode-lldb/releases/download/v1.10.0/codelldb-x86_64-windows.vsix"
[DEBUG 6/21/2024 3:06:27 PM] .../data/nvim-data/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://github.com/vadimcn/vscode-lldb/releases/download/v1.10.0/codelldb-x86_64-windows.vsix"
[DEBUG 6/21/2024 3:06:27 PM] ...ata/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "User-Agent: mason.nvim v1.10.0 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "-o", "C:\\Users\\thomastan\\.local\\data\\nvim-data\\mason\\staging\\codelldb\\.\\codelldb-x86_64-windows.vsix", "--connect-timeout", 30, "https://github.com/vadimcn/vscode-lldb/releases/download/v1.10.0/codelldb-x86_64-windows.vsix" }
}
[DEBUG 6/21/2024 3:06:27 PM] ...ata/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 15136
[DEBUG 6/21/2024 3:06:37 PM] ...ata/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=15136 exited with exit_code=0, signal=0
[DEBUG 6/21/2024 3:06:37 PM] ...azy/mason.nvim/lua/mason-core/installer/managers/std.lua:235: std: unpack "codelldb-x86_64-windows.vsix"
[DEBUG 6/21/2024 3:06:37 PM] ...azy/mason.nvim/lua/mason-core/installer/managers/std.lua:125: std: unzip "codelldb-x86_64-windows.vsix"
[DEBUG 6/21/2024 3:06:37 PM] ...cal/data/nvim-data/lazy/mason.nvim/lua/mason-core/fs.lua:84: fs: rename C:\Users\thomastan\.local\data\nvim-data\mason\staging\codelldb\.\codelldb-x86_64-windows.vsix C:\Users\thomastan\.local\data\nvim-data\mason\staging\codelldb\.\codelldb-x86_64-windows.vsix.zip
[DEBUG 6/21/2024 3:06:37 PM] ...ata/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="powershell", spawn_opts={
  args = { "-NoProfile", "-NonInteractive", "-Command", " $ErrorActionPreference = \"Stop\";  $ProgressPreference = 'SilentlyContinue';  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Microsoft.PowerShell.Archive\\Expand-Archive -Path \"codelldb-x86_64-windows.vsix.zip\" -DestinationPath ." },
  cwd = "C:\\Users\\thomastan\\.local\\data\\nvim-data\\mason\\staging\\codelldb\\.",
  env = { "ALLUSERSPROFILE=<redacted>", "HOMEPATH=<redacted>", "SYSTEMDRIVE=<redacted>", "LOGONSERVER=<redacted>", "NVIM_LOG_FILE=<redacted>", "XDG_STATE_HOME=<redacted>", "TMP=<redacted>", "USERNAME=<redacted>", "VBOX_MSI_INSTALL_PATH=<redacted>", "USERDOMAIN=<redacted>", "PROCESSOR_IDENTIFIER=<redacted>", "HOMEDRIVE=<redacted>", "COMSPEC=<redacted>", "XDG_CACHE_HOME=<redacted>", "USERDOMAIN_ROAMINGPROFILE=<redacted>", "COMMONPROGRAMW6432=<redacted>", "LOCALAPPDATA=<redacted>", "=<redacted>", "NUMBER_OF_PROCESSORS=<redacted>", "MASON=<redacted>", "PROCESSOR_REVISION=<redacted>", "PROCESSOR_LEVEL=<redacted>", "SYSTEMROOT=<redacted>", "DRIVERDATA=<redacted>", "PROGRAMW6432=<redacted>", "WINDIR=<redacted>", "OS=<redacted>", "XDG_BIN_HOME=<redacted>", "PUBLIC=<redacted>", "ONEDRIVE=<redacted>", "COMPUTERNAME=<redacted>", "COMMONPROGRAMFILES=<redacted>", "COMMONPROGRAMFILES(X86)=<redacted>", "PROCESSOR_ARCHITECTURE=<redacted>", "USERPROFILE=<redacted>", "PATHEXT=<redacted>", "PROGRAMFILES(X86)=<redacted>", "MYVIMRC=<redacted>", "PROGRAMDATA=<redacted>", "SESSIONNAME=<redacted>", "APPDATA=<redacted>", "VIMRUNTIME=<redacted>", "PROGRAMFILES=<redacted>", "XDG_CONFIG_HOME=<redacted>", "HOME=<redacted>", "TEMP=<redacted>", "PATH=C:\\Users\\thomastan\\.local\\data\\nvim-data/mason/bin;C:\\Windows;C:\\Windows\\system32;C:\\Windows\\system32\\OpenSSH;C:\\Program Files\\Git\\cmd;C:\\Users\\thomastan\\.local\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Neovim\\bin", "XDG_DATA_HOME=<redacted>", "VIM=<redacted>" }
}
[DEBUG 6/21/2024 3:06:37 PM] ...ata/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 2956

Neovim version (>= 0.7)

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068

Operating system/version

Windows 10 (Home), also tested Windows 11 (Pro) with the same problem.

Healthcheck

mason.nvim [Core utils] ~
- WARNING unzip: not available
  - ADVICE:
    - spawn: unzip failed with exit code - and signal -. unzip is not executable
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.7.1 (Windows) libcurl/8.7.1 Schannel zlib/1.3 WinIDN
`
- WARNING gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code - and signal -. gzip is not executable
- OK tar: `bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp 
`
- OK pwsh: `5.1.19041.4522  
`
- OK 7z: `7-Zip 22.01 ZS v1.5.5 R3 (x64) : Copyright (c) 1999-2022 Igor Pavlov, 2016-2023 Tino Reichardt : 2023-06-18
`

Screenshots

From Neovim:

powershell error

From powershell:

sshot1-powershell

From pwsh:

sshot2-pwsh
thomastan commented 1 week ago

Looks like the fix was staring at me right in the face in the screenshot I attached.

sshot3-fix

PR: https://github.com/williamboman/mason.nvim/pull/1740