Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes, winget doesn't work. #502

Closed
ghost opened this issue Jul 17, 2020 · 28 comments · Fixed by #1454
Closed

Sometimes, winget doesn't work. #502

ghost opened this issue Jul 17, 2020 · 28 comments · Fixed by #1454
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Issue-Docs It's a documentation issue that really should be on MicrosoftDocs
Milestone

Comments

@ghost
Copy link

ghost commented Jul 17, 2020

When I open Windows Terminal sometimes, and type in any winget-related command, nothing shows up and it acts like the enter key was pressed.
for example:
PS C:\Users\<<user>>> winget
PS C:\Users\<<user>>>

@ghost ghost added the Needs-Triage Issue need to be triaged label Jul 17, 2020
@denelon
Copy link
Contributor

denelon commented Jul 17, 2020

@lisaraj2009 can you run winget --info and share what version you are running? Also what version of Windows and Windows Terminal are you running?

@denelon denelon added Needs-Author-Feedback Issue needs attention from issue or PR author and removed Needs-Triage Issue need to be triaged labels Jul 17, 2020
@ghost
Copy link
Author

ghost commented Jul 18, 2020

No, I seem to be unable to run any winget-related command at certain times. At the time of writing, I'm running the latest version of winget. I'm running Windows Terminal 1.0.1811.0.

@ghost ghost added Needs-Attention Issue needs attention from Microsoft and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Jul 18, 2020
@doctordns
Copy link

can you try this:

Get-Command winget
# here is what I see:
Name          : winget.exe
ModuleName    :
Module        : @{Name=}
CommandType   : Application
Definition    : C:\Users\tfl.COOKHAM\AppData\Local\Microsoft\WindowsApps\winget.exe
ParameterSets : {}

@denelon denelon added Needs-Author-Feedback Issue needs attention from issue or PR author and removed Needs-Attention Issue needs attention from Microsoft labels Jul 27, 2020
@ghost ghost added the No-Recent-Activity Issue has no recent activity label Jul 31, 2020
@ghost

This comment has been minimized.

@sonj2
Copy link

sonj2 commented Aug 2, 2020

The author of the post hasn't responded yet, but since I have ran into the same issue I'll put what I got from Get-Command winget:

CommandType: Application
Name: winget.exe
Version: 0.0.0.0
Source: C:\Users...

I'm guessing the update got botched. I'll try uninstalling and reinstalling it. For reference, I am not in the Insider Program; OS build is 19041.388.

@ghost ghost removed the No-Recent-Activity Issue has no recent activity label Aug 2, 2020
@sonj2
Copy link

sonj2 commented Aug 2, 2020

When I try to install with the release appxbundle, it gives me the button to reinstall. When I click that, it tells me that winget is already at its latest version. Unless auto update for non-insiders is a thing now, Going through the reinstall doesn't change anything, and the Get-Command still says the version is 0.0.0.0

@sonj2
Copy link

sonj2 commented Aug 2, 2020

For uninstalling, the method of removing App Installer does remove winget but when reinstalling App Installer the broken winget seems to get reinstalled as well (my hunch being when user data is restored).

@sonj2
Copy link

sonj2 commented Aug 2, 2020

I've gotten around the issue by signing up for the Test Flight. It seemed that I had originally installed it manually and some update along the way may have broken it.

However, Get-Command winget will still state that the Version is 0.0.0.0

@ghost ghost added the No-Recent-Activity Issue has no recent activity label Aug 6, 2020
@ghost

This comment has been minimized.

@DrewNaylor
Copy link
Contributor

I'm running into the same "version 0.0.0.0" issue after installing winget 0.1.42101 Preview directly from the GitHub Releases page in Windows 10 version 10.0.19041.388.
winget was first installed in an Admin account and later installed in my regular/"Standard" account. Both are local accounts.

Get-Command winget displays "version 0.0.0.0" whether it's run in an Admin or "Standard" PowerShell window, so it seems like there's a different issue going on here as it works in both accounts.

Some additional output for reference:
Running winget in an Admin CMD window while in a "Standard" account displays The system cannot execute the specified program.
Running it in a regular CMD window in both the Admin account and the "Standard" account displays the regular expected help output.
Running it in an Admin CMD window in the Admin account works just fine.

PowerShell output when run from an Admin window in the "Standard" account:

Program 'winget.exe' failed to run: The file cannot be accessed by the systemAt line:1 char:1
+ winget
+ ~~~~~~.
At line:1 char:1
+ winget
+ ~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

I ran into this issue while trying to verify #528.

@ghost ghost removed the No-Recent-Activity Issue has no recent activity label Aug 6, 2020
@megamorf
Copy link

megamorf commented Aug 6, 2020

Don't mind the "0.0.0.0" version. PowerShell's Get-Command tries to read certain attributes of a binary to populate the properties of the command object and if that fails it falls back to a default value of 0.0.0.0. That's not an indicator for something being wrong.

I believe running Get-Command was suggested to prove that the winget itself is actually being found by PowerShell. Had Get-Command winget not returned anything you'd known that something is wrong with the PATH environment variable.

@ghost ghost added the No-Recent-Activity Issue has no recent activity label Aug 11, 2020
@ghost

This comment has been minimized.

@ghost ghost closed this as completed Aug 14, 2020
@matsura8
Copy link

Issue still persists and I've encounter this with the issue with previously working and newly install versions of Linux under wsl not being found, even immediately after install.

I seem to run into these issues a lot. Apparently, Microsoft has deployed bot to close cases as inactive rather than actually fixing the code on their closed source OS. Some 30 years after Microsoft set the standard of releasing buggy software and fixing it later through updates, I guess this is Microsoft again setting the bar for the rest of industry by now declaring it does not ever need to fix those bugs.

Anyway, marking this issue as relevant again as latest insider build has broken all functionality of wsl (which the CUDA support for wsl in an insider build was the whole reason for me to switch to an insider build).

@ghost ghost removed the No-Recent-Activity Issue has no recent activity label Feb 24, 2021
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Feb 24, 2021
@denelon
Copy link
Contributor

denelon commented Feb 24, 2021

I need to clean up the messaging from the bot. When we put "Needs author feedback" we're looking for additional data. That's when the bot would close (assuming no response). I've opened this back up.

@denelon denelon reopened this Feb 24, 2021
@denelon
Copy link
Contributor

denelon commented Apr 27, 2021

We need to capture some of the scenarios where the App Execution Alias is disabled and results in this error. We can add some F.A.Q.s to help users troubleshoot this problem, and explicitly identify the different error messages a user might see when this is what is preventing the winget.exe command from functioning correctly.

@denelon denelon added the Issue-Docs It's a documentation issue that really should be on MicrosoftDocs label May 6, 2021
@denelon denelon added this to the v.Next - Windows Package Manager milestone May 21, 2021
@JoeLyga
Copy link

JoeLyga commented May 27, 2021

This happens to me too. I had just installed v1.0.11451 from github releases. Though it was likely broken before too. At first, the command wasn't recognized. So I added the WindowsApps directory to my user path: %userprofile%\AppData\Local\Microsoft\WindowsApps

Even afterwards, the command wasn't recognized. If I navigate manually to %userprofile%\AppData\Local\Microsoft\WindowsApps and run .\winget, there is no output.

If I run Get-Command on winget, it comes up as version 0.0.0.0.

I've tried resetting and reinstalling a few times, but mine seems to be in a broken state.

PS C:\Users\lygaj\AppData\Local\Microsoft\WindowsApps> winget
winget: The term 'winget' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Suggestion [3,General]: The command winget was not found, but does exist in the current location. PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\winget". See "get-help about_Command_Precedence" for more details.
PS C:\Users\lygaj\AppData\Local\Microsoft\WindowsApps> .\winget
PS C:\Users\lygaj\AppData\Local\Microsoft\WindowsApps>

@denelon
Copy link
Contributor

denelon commented May 27, 2021

@JoeLyga there is also an App Execution Alias to map the actual .exe to winget.exe. Do you have that enabled as well?

@Stefanuk12
Copy link

I'm having the same issue (installed via GitHub releases), however, when attempting to do it via PS (with admin priv.) I get the following error

Program 'winget.exe' failed to run: The file cannot be accessed by the systemAt line:1 char:1
+ winget.exe
+ ~~~~~~~~~~.
At line:1 char:1
+ winget.exe
+ ~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

I also tried to cd into the directory where it is installed too and that did not work. If it helps, I have winget installed both on the admin and standard account. I have checked and the App Execution Alias on both accounts for winget is enabled.

@VidarPT
Copy link

VidarPT commented Jun 2, 2021

Not sure if I should be posting here or creating a new issue. Winget doesn't run anymore but in my case I can actually explain what lead to this situation. The error I get under CMD is:

The system cannot execute the specified program.

And via PowerShell:

Program 'winget.exe' failed to run: The process has no package identityAt line:1 char:1
+ winget
+ ~~~~~~.
At line:1 char:1
+ winget
+ ~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

"Get-Command winget" reports:

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     winget.exe                                         0.0.0.0    C:\Users\Daniel\AppData\Local\Microsoft\WindowsApps\winget.exe

I've run:
Get-AppXPackage Microsoft.DesktopAppInstaller | Remove-AppXPackage
And reinstalled App Installer via the Microsoft Store. Nothing.

Now I'll get into what caused this. A few days ago my Store was botched and failing to update most apps. I haven't a clue what caused this but there I was getting errors on many apps trying to update. Following some research on the internet, I found people suggesting changing the owner of the WindowsApp folder to my admin user and adding myself to the permissions so I could delete the app folder, purge any registry settings and so forth. This actually worked. You'd think I'd destroy my system but it actually worked. The apps updated and everything was fine. During this time I found out about Winget and ended up installing it too. Really cool to have a package manager for Windows. A few days after I remembered I had forgotten to restore the WindowsApp back to TrustedInstaller. So I did just that. I went to the security tab in properties and set it back to NT Service\TrustedInstaller. Problem was I received many "Permission Denied" errors when trying to change it back. Following some more research I came up with a neat program from SysInternals called "psexec.exe" that's capable of giving me SYSTEM-shell. Through that I ran:

psexec.exe -s icacls "C:\Program Files\WindowsApps" /reset /t /c /q

And it seems to have worked. I started getting a bunch of errors for a multitude of apps though. Such as the Xbox app. Couldn't even open it. Some error about parameters. Sorry I forget what it was exactly. After reinstalling these apps, everything's fine again. With the exception of Winget. Like I said, reinstalling App Installer from the Microsoft Store doesn't solve the problem.
I might have created a mess trying to solve Windows's own mess.

@denelon
Copy link
Contributor

denelon commented Jun 2, 2021

@VidarPT try installing the App Installer from the 1.0.11451 release. Unless you are on a Windows Insider build or you are in the Windows Package Manager Insider program, you will get v1.10.x of the App Installer not containing the Windows Package Manager from the Microsoft Store.

@jimmyjammin
Copy link

jimmyjammin commented Jun 9, 2021

Installed this morning using the bundle from the GitHub page (v1.0.11451) and using Add-AppxPackage. Running into the same issue, but this is what I discovered.

If I run PS as the account that I'm logged in as, WinGet works. This works for a non-admin AD account as well as an different AD with admin creds. Now if I escalate privileges for PS using the admin account while logged with the standard user, it doesn't work.

All app store packages were fully updated at the time of testing.

[Edit] For poops and giggles I tried it with ye old cmd terminal, got the same results as above.

@msanchezdev
Copy link

I also noticed the problem with other apps I had installed.
I recently reinstalled windows keeping my files because I screwed up C:\Program Files\WindowsApps and could not install nor start anything related to the Microsoft Store

But the command pointed above fixed it

psexec.exe -s icacls "C:\Program Files\WindowsApps" /reset /t /c /q

But looks like something is still broken

image

@GizmoTheGreen
Copy link

GizmoTheGreen commented Jul 27, 2021

I get no output from winget, not in cmd or in powershell, as my regular user or as admin

PS C:\WINDOWS\system32> winget
PS C:\WINDOWS\system32>

as if I didn't enter anything at all.
get-command winget gives
CommandType Name Version Source
----------- ---- ------- ------
Application winget.exe 0.0.0.0 C:\Users\[privacy]\AppData\Local\Microsoft\WindowsApps\winget.exe

tried removing and manually installing latest appxbundle from github didn't change anything.
I'm on win10pro 21h1.

@ashpatil-msft ashpatil-msft linked a pull request Sep 10, 2021 that will close this issue
2 tasks
@Bahnschrift
Copy link

Bahnschrift commented Sep 12, 2021

@VidarPT I've managed to run into exactly the same issue. I've tried the same steps as you, uninstalling and reinstall AppInstaller, but still getting the same issue of:

ResourceUnavailable: Program 'winget.exe' failed to run: The process has no package identity.At line:1 char:1
+ winget
+ ~~~~~~.

Did you ever find a solution?

@denelon
Copy link
Contributor

denelon commented Sep 13, 2021

@Bahnschrift take a look at https://github.com/microsoft/winget-cli/tree/master/doc/troubleshooting. If that doesn't resolve the issue you are having, please file a new bug.

@denelon denelon modified the milestones: v.Next-Client, v1.2 Client, v1.1-Client Oct 1, 2021
@avipars
Copy link

avipars commented Oct 11, 2022

Try opening CMD as admin, then proceed... For me, winget was installed correctly, but had an issue with regular user credentials/permissions.

@ranyong1997
Copy link

May I ask if my path will affect the winget acquisition? There are other problems
image

image

@patientx
Copy link

same problem this happened out of no where, I was able to install apps with winget and was able to use it all the time, now

Get-Command winget
Get-Command : The term 'winget' 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:1

  • Get-Command winget
  •   + CategoryInfo          : ObjectNotFound: (winget:String) [Get-Command], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
    
    

and winget as a command doesn't get recognised in cmdline ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Issue-Docs It's a documentation issue that really should be on MicrosoftDocs
Projects
None yet
Development

Successfully merging a pull request may close this issue.