当我运行flutter doctor时,我得到这个错误
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)第二个错误应该通过删除flutter/bin中的缓存文件夹并运行flutter doctor来更正,但每次都会发生这种情况
发布于 2021-01-18 19:08:36
您可以使用following one编辑定位到的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
}https://stackoverflow.com/questions/61835446
复制相似问题