Flutter 在powershell上运行Flatter doctor时,扩展zip存档似乎会导致错误
我在运行“颤振医生”时遇到了这个错误Flutter 在powershell上运行Flatter doctor时,扩展zip存档似乎会导致错误,flutter,dart,visual-studio-code,Flutter,Dart,Visual Studio Code,我在运行“颤振医生”时遇到了这个错误 PS C:\Users\CHIDUBEM> flutter doctor Checking Dart SDK version... Downloading Dart SDK from Flutter engine 6bc433c6b6b5b98dcf4cc11aff31cdee90849f32... Unzipping Dart SDK... New-Object : Exception calling ".ctor" with "3" argumen
PS C:\Users\CHIDUBEM> flutter doctor
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 6bc433c6b6b5b98dcf4cc11aff31cdee90849f32...
Unzipping Dart SDK...
New-Object : Exception calling ".ctor" with "3" argument(s): "Central Directory corrupt."
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:934 char:23
+ ... ipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -Ar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
Building flutter tool...
Running pub upgrade...
The system cannot find the path specified.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
第二个错误应该通过删除flatter/bin中的缓存文件夹并运行flatter doctor来纠正,但每次都会发生这种情况您可以使用以下命令编辑定位的psm1文件:
你找到解决办法了吗?
$zipArchiveArgs = @($archiveFileStream, [System.IO.Compression.ZipArchiveMode]::Read, $false)
try
{
$zipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -ArgumentList $zipArchiveArgs
}
catch [System.IO.InvalidDataException]
{
# Failed to open the file for reading as a zip archive. Wrap the exception
# and re-throw it indicating it does not appear to be a valid zip file.
$exception = $_.Exception
if($null -ne $_.Exception -and
$null -ne $_.Exception.InnerException)
{
$exception = $_.Exception.InnerException
}
# Load the WindowsBase.dll assembly to get access to the System.IO.FileFormatException class
[System.Reflection.Assembly]::Load('WindowsBase,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35')
$invalidFileFormatException = New-Object -TypeName System.IO.FileFormatException -ArgumentList @(
($LocalizedData.ItemDoesNotAppearToBeAValidZipArchive -f $archiveFile)
$exception
)
throw $invalidFileFormatException
}