Repository navigation
Errors in powershell script update_dart_sdk #8606
Description
I'm on Windows 7 and followed the setup instructions https://github.com/flutter/flutter/wiki/Flutter-on-Windows. I'm not very firm with the power shell but I have experience with flutter on Mac.
First of all, it was not possible to run the powershell script, cause the execution was disabled for safty reasons. I need to run the command Set-ExecutionPolicy Unrestricted to continue (Would be a good note to the docs).
After that, I run flutter doctor and got some errors in flutter\bin\internal\update_dart_sdk.ps1. The errors are in german, so I think It's not very helpful.
First error (unknown command Start-BitsTransfer):
Die Benennung Start-BitsTransfer wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
Bei C:\d\Source\Dev\flutter\bin\internal\update_dart_sdk.ps1:44 Zeichen:19
+ Start-BitsTransfer <<<< -Source $dartSdkUrl -Destination $dartSdkZip
+ CategoryInfo : ObjectNotFound: (Start-BitsTransfer:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
The solution for the first error was to add the line Import-Module BitsTransfer at the beginning of the script.
Second error (could not load Assemply)
Add-Type : Typ kann nicht hinzugefügt werden. Die Assembly "system.io.compression.filesystem" konnte nicht gefunden wer
den.
Bei C:\d\Source\Dev\flutter\bin\internal\update_dart_sdk.ps1:47 Zeichen:9
+ Add-Type <<<< -assembly "system.io.compression.filesystem"
+ CategoryInfo : ObjectNotFound: (system.io.compression.filesystem:String) [Add-Type], Exception
+ FullyQualifiedErrorId : ASSEMBLY_NOT_FOUND,Microsoft.PowerShell.Commands.AddTypeCommand
For the second error I changed line 46:
#Add-Type -assembly "system.io.compression.filesystem"
[System.Reflection.Assembly]::LoadWithPartialName("system.io.compression.filesystem")
I think the system.io.compression.filesystem assembly was loaded from .Net Framework 4.5. Maybe it would be good to add a note to the installation instrunctions.
After all, the update_dart_sdk.ps1 runs without errors.
Activity
jsiedentop commentedon Mar 7, 2017
I get an exception when I run
flutter doctor. Is this related to the "No spaces in path" error reported recently? I've seen an issue a few days ago and my Android Studio is installed under the default path: "C:\Program Files\Android\Android Studio".command
exception
FileSystemException: writeFrom failed, path = '' (OS Error: Der Vorgang wurde erfolgreich beendet.
, errno = 0)
Translation for the error message: The operation completed successfully.
flutter doctor
jacoplane commentedon Mar 7, 2017
I was able to run the powershell script by setting Set-ExecutionPolicy RemoteSigned, which is somewhat more secure than "Unrestricted". It might also work with "AllSigned", I haven't tried that. These are the different options:
goderbauer commentedon Mar 7, 2017
@jsiedentop Thanks for the detailed report. I've filed a separate issue for the PowerShell Execution Policy as that one probably needs further investigation.
I am looking at your other issues now. You're probably the first one running on Windows 7, which is probably the reason for some of these failures.
Can you tell me what version of PowerShell you have installed on your system?
$PSVersionTable.PSVersionexecuted in a PowerShell should show you that.goderbauer commentedon Mar 7, 2017
@jsiedentop About the
flutter doctorcrash you're reporting: Is that happening every single time you runflutter doctor? Or was that just a one-time issue?/cc @zanderso Any idea about the dart crash when writing to stdout (see stack-trace above)?
goderbauer commentedon Mar 7, 2017
@jsiedentop I've made some adjustments to our PowerShell scripts. In a fresh checkout of flutter (make sure there is no
cachesub-dir underflutter/bin) can you please executeflutter doctoragain and tell me if that works now without modifications to the PowerShell scripts. Thanks!jsiedentop commentedon Mar 8, 2017
You are welcome. Because of the time shift I didn't read your question before. I get the crash every single time I run flutter doctor. Even if I run flutter doctor in cmd I got an crash.
I did a fresh clone of the Flutter repository (deleted the flutter dir before).
Run Flutter doctor in PowerShell:
The flutter.bat exists. Semms, that the ps-script didn't realize, that this is a call.
Run Flutter doctor in cmd:
The command 'Expand-Archive' is unknown, only avalable with PowerShell 5. I downloaded and install the Windows Management Framework 5.0 (https://ss64.com/ps/expand-archive.html).
With the new PowerShell version the update_dart_sdk.ps1 script runs successfully.
With the new Power Shell version the flutter doctor command runs also successfully. It seems, that the std-out exception depends on the old PowerShell Version.
goderbauer commentedon Mar 8, 2017
Very cool. Looks like we currently require a pretty new version of PowerShell. I'll see if we can make the script compatible with older versions. If not, I'll add a note to the install instructions.
With that, it seems like this issue is resolved and you got Flutter running on Windows?
jsiedentop commentedon Mar 8, 2017
Almost, I've got problems with the Android simulator, but this is another point (Take a look tomorrow). Thanks for the great support and the work on the Flutter projekt. A hint to the minimum Power Shell version would be great, but then you can close the issue.
Ensure compatibility with older PowerShell versions and better error …
github-actions commentedon Sep 5, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.