microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.28k stars 1.45k forks source link

Winget import exits early with no error (No packages installed) #2569

Open JonLevin25 opened 2 years ago

JonLevin25 commented 2 years ago

Brief description of your issue

winget import winget_buggy_import.json does not install most packages listed. (i.e. Visual Studio installer, or Todoist, the first 2 in the list)

The output shows 6 'not found' packages, and one admin priveleges error. Trying as admin did not help.

Trying a smaller export list (winget_small_import_works.json, containing only the first two packages) Installs them OK.

I've had issues before with import exiting early - #1377, but removing only the VCRedist packages did not help, so this may be something else.

winget_buggy_import.json winget_small_import_works.json

Steps to reproduce

winget import winget_buggy_import.json

Expected behavior

All valid packages should be installed, individual issues should be output as errors to the console

Actual behavior

Most packages are not installed. No descriptive error is output.

> winget import winget_buggy_import.json
No applicable update found.
Package is already installed: Microsoft.EdgeWebView2Runtime
This command requires administrator privileges to execute.
https://github.com/microsoft/winget-cli/issues/2368
Package not found for import: Rufus.Rufus
No applicable update found.
Package is already installed: Google.Chrome
No applicable update found.
Package is already installed: Atlassian.Sourcetree
No applicable update found.
Package is already installed: Microsoft.WindowsPCHealthCheck
No applicable update found.
Package is already installed: Microsoft.VisualStudioCode
> 

Environment

Windows Package Manager v1.3.2091
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19044.2006
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2091.0
JonLevin25 commented 2 years ago

Small note about the github issue form/comments - there used to be a way to upload files directly. I couldn't find it and used pastebin this time. Was the feature removed?

denelon commented 1 year ago

@JonLevin25,

We've made several improvements in WinGet 1.4 related to the install and upgrade flows. Is this problem still happening?

JanErikAnkervigTrydal commented 1 year ago

I have the same issue as described by @JonLevin25. Fresh install of Windows 11 running on Hyper-V. WinGet version v1.4.10173

JanErikAnkervigTrydal commented 1 year ago

After further debugging, I found that removing "Canonical.Ubuntu" allowed WinGet to complete successfully without early exit.

Steps to reproduce

My winget-export.json looks like this:

{
    "$schema" : "https://aka.ms/winget-packages.schema.2.0.json",
    "CreationDate" : "2023-01-16T08:49:34.174-00:00",
    "Sources" : 
    [
        {
            "Packages" : 
            [
                {
                    "PackageIdentifier" : "7zip.7zip"
                },
                {
                    "PackageIdentifier" : "Bitvise.SSH.Client"
                },
                {
                    "PackageIdentifier" : "Canonical.Ubuntu"
                },
                {
                    "PackageIdentifier" : "voidtools.Everything"
                },
                {
                    "PackageIdentifier" : "Git.Git"
                },
                {
                    "PackageIdentifier" : "Microsoft.Edge"
                },
                {
                    "PackageIdentifier" : "Microsoft.EdgeWebView2Runtime"
                },
                {
                    "PackageIdentifier" : "Microsoft.WindowsTerminal"
                },
                {
                    "PackageIdentifier" : "Notepad++.Notepad++"
                },
                {
                    "PackageIdentifier" : "Microsoft.Office"
                },
                {
                    "PackageIdentifier" : "Microsoft.OneDrive"
                },
                {
                    "PackageIdentifier" : "Postman.Postman"
                },
                {
                    "PackageIdentifier" : "Spotify.Spotify"
                },
                {
                    "PackageIdentifier" : "Lenovo.SystemUpdate"
                },
                {
                    "PackageIdentifier" : "Microsoft.Teams"
                },
                {
                    "PackageIdentifier" : "Debian.Debian"
                },
                {
                    "PackageIdentifier" : "VideoLAN.VLC"
                },
                {
                    "PackageIdentifier" : "WinDirStat.WinDirStat"
                },
                {
                    "PackageIdentifier" : "WinMerge.WinMerge"
                },
                {
                    "PackageIdentifier" : "WiresharkFoundation.Wireshark"
                },
                {
                    "PackageIdentifier" : "Google.Chrome"
                },
                {
                    "PackageIdentifier" : "Microsoft.PowerToys"
                },
                {
                    "PackageIdentifier" : "OpenJS.NodeJS"
                },
                {
                    "PackageIdentifier" : "CodeSector.TeraCopy"
                },
                {
                    "PackageIdentifier" : "PuTTY.PuTTY"
                },
                {
                    "PackageIdentifier" : "Microsoft.VisualStudioCode"
                },
                {
                    "PackageIdentifier" : "Python.Python.3.10"
                },
            ],
            "SourceDetails" : 
            {
                "Argument" : "https://cdn.winget.microsoft.com/cache",
                "Identifier" : "Microsoft.Winget.Source_8wekyb3d8bbwe",
                "Name" : "winget",
                "Type" : "Microsoft.PreIndexed.Package"
            }
        }
    ],
    "WinGetVersion" : "1.3.2691"
}

Remove item:

{
    "PackageIdentifier" : "Canonical.Ubuntu"
},

Commando:

winget import -i winget-export.json

I hope this helps 😊

Trenly commented 1 year ago

[Policy] Command-Import

KallynGowdy commented 3 weeks ago

I have run into a similar issue with v1.8.1991. When importing a json file where most packages are already installed, but some are not, all the packages that are not installed are just skipped. When importing a simplified json file with only uninstalled packages, it works fine.