winget-cli: Vim install fails with error code 2

Brief description of your issue

When I try to install vim (technically gvim) using winget, the download succeeds but then it immediately errors out. Full output shown below:

PS C:\Users\(me)> winget install vim
Found vim [vim.vim]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Installing ...
Installer failed with exit code: 2

Steps to reproduce

winget install vim

I also tried running with the -i flag, and when I do, instead of just erroring I get a popup dialog

2020-07-16

Light googling of the error message indicates it may be a problem with vim’s installer. Nevertheless, silently failing is still an issue with winget.

Expected behavior

Vim installs

Actual behavior

Vim does not install

Environment

I am running as a nonprivileged user. I have not tried running PowerShell as administrator; I prefer to use this tool as a regular user and just do the admin account pw in a UAC dialog when necessary.

[winget --info]
Windows Package Manager v0.1.41821 Preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19041.388
Package: Microsoft.DesktopAppInstaller v1.0.41821.0

Thanks for reading! 😃

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 35 (19 by maintainers)

Most upvoted comments

@denelon , even in admin account, as usual I run poweshell in Medium IL . but this Invokes UAC. where as in user account , same running in Medium IL, doesn’t invoke UAC and winget reports as if install completed. Screenshot 2021-05-07 153401 Screenshot 2021-05-07 153737

priviledges for both accounts are same in Medium IL, seems winget has something doing wrong here with elevating installers between admin and user accounts.

We’ve added the log location to winget --info. You can also use [Win]+[f] to submit feedback which attaches logs to submit bugs.

This will be fixed by:

  • #1537
  • microsoft/winget-pkgs/issues/29148

I’d like to add here the current state with the following winget --info:

Windows Package Manager v1.0.11451 Copyright © Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19042.985 Package: Microsoft.DesktopAppInstaller v1.11.11451.0

Stretchly v1.7.0 now installs successfully when winget install has been started from an elevated prompt. 🎉 Otherwise, it seems there is an error with the setup (no UAC prompt / no elevation) while it tries to write to C:\Windows\TEMP\.

Verified it with Process Monitor: grafik

@denelon

it seems winget checks for installers UAC permissions , hence denying UAC results in winget reporting installation canceled.
Screenshot 2021-05-08 035405

trying to manually downloading and installing also fails because installer doesn’t auto elevate from standard account. installing to ~\UserFolder installs fine but doesn’t register to ARP list 😃 (irony) Screenshot 2021-05-08 040531 but the same installer auto elevates when run from admin account. those who had commented that choco installs fine, most probably they had run those installers from an admin account.

It seems NSIS Installers check for admin accounts and only elevate the installers when run from admin accounts only. don’t know if this is a unfixed bug or what. but this is how it is. found a similar looking github issue here : electron-builder: NSIS fails for standard users? NSIS Installer references site says :

Windows Vista/7 automatically identifies NSIS installers and decides administrator privileges are required.

My suggestion : since it seems this is not vim or stretchly specific issue rather a generic issue of NSIS installers, I will suggest you to close this issue and focus on implementing following behaviors : when implementing User vs System ,

  1. a system/all users switch should auto elevate installers/uninstallers, thus issues like these could be solved.
  2. a particular user/self switch should also register the program to user ARP list. so that winget list can list them.

just my 2 cents 😃

@denelon this vim thing has serious problems .

first of, the installer requires admin privilege and invokes UAC when run from admin account. when run from non-admin account, it doesn’t ask UAC hence it does not even install at all but winget mysteriously reports it installed .

second, the uninstaller doesn’t even support silent uninstall (and I do wonder why this pckg was allowed in winget even in first place. ) and requires Interactive clicky-clicky uninstalling process. Event tho only the uninstaller gui confirmations window shows up Ironically again winget falsely reports it as uninstall completed thus in the uninstallation process vim acts as if a non-winget pckg !! (which is the point of issue no. #912)

demonstrating second point :
this is winget running from an admin account 2021-05-07-070700

@denelon I’ve reproduced the same bug - error code 2 after trying to install vim. I guess, when you say in this comment that you’ve been able to “install as a user”, actually you’ve been using user with administrator privileges, even though not using an elevated cmdline prompt. You should instead test under such user which does not have administrator rights at all.

OK, I’ll keep this bug open so we can try to find others who are having the same problem if we can’t reproduce the issue. We’re getting close to completing several key features, and then we will start digging into the bugs here “label:Issue-Bug”.