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
22.5k stars 1.39k forks source link

winget import says json file is not valid. #4556

Closed rikusen0335 closed 1 week ago

rikusen0335 commented 1 week ago

Brief description of your issue

Doing winget import -i ... will say json file is no valid

Steps to reproduce

Make a file from copy of this: https://hastebin.skyra.pw/inacodawen.json then winget import -i MyAppList.json --ignore-versions --accept-package-agreements --ignore-unavailable

Expected behavior

winget going to import it.

Actual behavior

As title says, winget import says json file is not valid.

Environment

Originally they are outputs of Japanese, thus it may have some weird spacing.

Windows Package Manager (Preview) v1.9.1551-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.3593
System Architecture: X64
Packages: Microsoft.DesktopAppInstaller v1.24.1551.0
Trenly commented 1 week ago

After downloading the linked file, I don't get the same error.

PS C:\Users\WDAGUtilityAccount\Desktop\winget-pkgs> winget import -i C:\Users\WDAGUtilityAccount\Downloads\import.json --ignore-versions --accept-package-agreements --ignore-unavailable
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.
Package is already installed: Microsoft.Edge
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.
Package is already installed: Microsoft.AppInstaller
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.
Package is already installed: Microsoft.UI.Xaml.2.7
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.
Package is already installed: Microsoft.UI.Xaml.2.8
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.
Package is already installed: Microsoft.VCLibs.Desktop.14
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.
Package is already installed: Microsoft.VCRedist.2015+.x86
The packages found in this import have the following dependencies:
  - Packages
      Microsoft.VCRedist.2015+.x64
      Microsoft.WindowsAppRuntime.1.5
      Microsoft.UI.Xaml.2.8 [>= 8.2306.22001.0]
      EclipseAdoptium.Temurin.11.JRE
      Microsoft.DotNet.DesktopRuntime.6
      Microsoft.DotNet.AspNetCore.6
      Microsoft.EdgeWebView2Runtime
(1/110) Found Satisfactory Mod Manager [SatisfactoryModding.SatisfactoryModManager] Version 2.9.3
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/satisfactorymodding/SatisfactoryModManager/releases/download/v2.9.3/Satisfactory-Mod-Manager-Setup.exe
  ███▏                            6.82 MB / 63.8 MB

Can you provide the log files from winget import -i MyAppList.json --ignore-versions --accept-package-agreements --ignore-unavailable --verbose ?

rikusen0335 commented 1 week ago

@Trenly Thank you for quick response. I tried some like them: --verbose or --verbose-logs but they still saying json file is not valid.

This is in Japanese, but JSONファイルが無効です means exactly JSON file is not valid image

Also I tried Run as administrator and just normal user.

Trenly commented 1 week ago

@Trenly Thank you for quick response. I tried some like them: --verbose or --verbose-logs but they still saying json file is not valid.

This is in Japanese, but JSONファイルが無効です means exactly JSON file is not valid image

Also I tried Run as administrator and just normal user.

The log files are not the same as the output from the command line; The logs are stored in the filesystem, and the directory they are stored in can be found using winget --info. Otherwise, if you add the --logs argument to the command, the folder should open after the command finishes

rikusen0335 commented 1 week ago

Okay, I am like really an idiot. Found a stuff in the log: 2024-06-14 23:43:05.534 [CLI ] Failed to read JSON: * Line 352, Column 7 Syntax error: value, object or array expected. There was an = misplaced (cause I modified and typoed), deleted it and fixed. Thank you.

Trenly commented 1 week ago

Okay, I am like really an idiot. Found a stuff in the log: 2024-06-14 23:43:05.534 [CLI ] Failed to read JSON: * Line 352, Column 7 Syntax error: value, object or array expected. There was an = misplaced (cause I modified and typoed), deleted it and fixed. Thank you.

Glad to have been able to help!