Skip to content

Errors in powershell script update_dart_sdk  #8606

Closed

Description

@jsiedentop

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

  1. jsiedentop commented on Mar 7, 2017

    @jsiedentop
    Author

    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

    flutter doctor
    Updating flutter tool...
    Downloading Material fonts...
    Downloading package sky_engine...
    Downloading windows-x64 tools...
    Downloading android-arm-profile/windows-x64 tools...
    Downloading android-arm-release/windows-x64 tools...
    Downloading android-x86 tools...
    Downloading android-x64 tools...
    Downloading android-arm tools...
    Downloading android-arm-profile tools...
    Downloading android-arm-release tools...
    [
    Oops; flutter has exited unexpectedly.

    exception

    FileSystemException: writeFrom failed, path = '' (OS Error: Der Vorgang wurde erfolgreich beendet.
    , errno = 0)

    Translation for the error message: The operation completed successfully.

    dart:io                                                           _StdSinkHelper.write
    package:flutter_tools/src/base/logger.dart 128                    WindowsStdoutLogger.writeToStdOut
    package:flutter_tools/src/base/logger.dart 88                     StdoutLogger.printStatus
    package:flutter_tools/src/globals.dart 35                         printStatus
    package:flutter_tools/src/doctor.dart 132                         Doctor.diagnose
    package:flutter_tools/src/commands/doctor.dart 19                 DoctorCommand.runCommand
    package:flutter_tools/src/runner/flutter_command.dart 148         FlutterCommand.verifyThenRunCommand
    package:flutter_tools/src/runner/flutter_command.dart 119         FlutterCommand.run
    package:args/command_runner.dart 194                              CommandRunner.runCommand
    package:flutter_tools/src/runner/flutter_command_runner.dart 261  FlutterCommandRunner.runCommand
    package:args/command_runner.dart 109                              CommandRunner.run.<fn>
    dart:async                                                        Future.Future.sync
    package:args/command_runner.dart 109                              CommandRunner.run
    package:flutter_tools/src/runner/flutter_command_runner.dart 158  FlutterCommandRunner.run
    package:flutter_tools/executable.dart 145                         run.<fn>.<fn>
    package:stack_trace                                               Chain.capture
    package:flutter_tools/executable.dart 144                         run.<fn>
    package:flutter_tools/src/base/context.dart 76                    AppContext._run
    package:flutter_tools/src/base/context.dart 66                    AppContext.runInZone.<fn>
    dart:async                                                        runZoned
    package:flutter_tools/src/base/context.dart 65                    AppContext.runInZone
    package:flutter_tools/executable.dart 114                         run
    package:flutter_tools/executable.dart 68                          main
    ..\..\packages\flutter_tools\bin\flutter_tools.dart 8             main
    ===== asynchronous gap ===========================
    dart:io                                                           _StdSinkHelper.write
    package:flutter_tools/src/base/logger.dart 128                    WindowsStdoutLogger.writeToStdOut
    package:flutter_tools/src/base/logger.dart 88                     StdoutLogger.printStatus
    package:flutter_tools/src/globals.dart 35                         printStatus
    package:flutter_tools/src/doctor.dart 132                         Doctor.diagnose
    ===== asynchronous gap ===========================
    dart:io                                                           _StdSinkHelper.write
    package:flutter_tools/src/base/logger.dart 128                    WindowsStdoutLogger.writeToStdOut
    package:flutter_tools/src/base/logger.dart 88                     StdoutLogger.printStatus
    package:flutter_tools/src/base/logger.dart 109                    StdoutLogger.startProgress
    package:flutter_tools/src/cache.dart 223                          MaterialFonts.download
    package:flutter_tools/src/cache.dart 179                          Cache.updateAll
    ===== asynchronous gap ===========================
    dart:async                                                        Future.Future.microtask
    package:flutter_tools/src/cache.dart                              Cache.updateAll
    package:flutter_tools/src/runner/flutter_command.dart 137         FlutterCommand.verifyThenRunCommand
    ===== asynchronous gap ===========================
    dart:async                                                        Future.Future.microtask
    package:flutter_tools/src/runner/flutter_command.dart             FlutterCommand.verifyThenRunCommand
    package:flutter_tools/src/runner/flutter_command.dart 119         FlutterCommand.run
    package:args/command_runner.dart 194                              CommandRunner.runCommand
    ===== asynchronous gap ===========================
    dart:async                                                        Future.Future.microtask
    package:args/command_runner.dart                                  CommandRunner.runCommand
    package:flutter_tools/src/runner/flutter_command_runner.dart 261  FlutterCommandRunner.runCommand
    ===== asynchronous gap ===========================
    dart:async                                                        _asyncThenWrapperHelper
    package:flutter_tools/src/runner/flutter_command_runner.dart      FlutterCommandRunner.runCommand
    package:args/command_runner.dart 109                              CommandRunner.run.<fn>
    dart:async                                                        Future.Future.sync
    package:args/command_runner.dart 109                              CommandRunner.run
    package:flutter_tools/src/runner/flutter_command_runner.dart 158  FlutterCommandRunner.run
    package:flutter_tools/executable.dart 145                         run.<fn>.<fn>
    ===== asynchronous gap ===========================
    dart:async                                                        Future.Future.microtask
    package:flutter_tools/executable.dart                             run.<fn>.<fn>
    package:stack_trace                                               Chain.capture
    package:flutter_tools/executable.dart 144                         run.<fn>
    

    flutter doctor

    [✓] Flutter (on Windows, channel master)
        • Flutter at C:\source\flutter
        • Framework revision 24eeddc053 (10 hours ago), 2017-03-06 18:20:04
        • Engine revision f9c1f5fa53
        • Tools Dart version 1.23.0-dev.2.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK 25.0.2)
        • Android SDK at C:\Users\jsi\AppData\Local\Android\sdk
        • Platform android-25, build-tools 25.0.2
        • Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    
    [✓] Android Studio (version 1.4)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Gradle version 3.2
    
    [-] WebStorm (version 10)
        • Flutter plugin not installed; this adds Flutter specific functionality.
        • For information about managing plugins, see
          https://www.jetbrains.com/help/idea/managing-plugins.html
    
    [-] WebStorm (version 2016.2)
        • Flutter plugin not installed; this adds Flutter specific functionality.
        • For information about managing plugins, see
          https://www.jetbrains.com/help/idea/managing-plugins.html
    
    [✓] Connected devices
        • None
    
  2. jacoplane commented on Mar 7, 2017

    @jacoplane

    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:

    • Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.
    • AllSigned - Only scripts signed by a trusted publisher can be run.
    • RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.
    • Unrestricted - No restrictions; all Windows PowerShell scripts can be run.
  3. goderbauer commented on Mar 7, 2017

    @goderbauer
    Member

    @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.PSVersion executed in a PowerShell should show you that.

  4. goderbauer commented on Mar 7, 2017

    @goderbauer
    Member

    @jsiedentop About the flutter doctor crash you're reporting: Is that happening every single time you run flutter 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)?

  5. goderbauer commented on Mar 7, 2017

    @goderbauer
    Member

    @jsiedentop I've made some adjustments to our PowerShell scripts. In a fresh checkout of flutter (make sure there is no cache sub-dir under flutter/bin) can you please execute flutter doctor again and tell me if that works now without modifications to the PowerShell scripts. Thanks!

  6. jsiedentop commented on Mar 8, 2017

    @jsiedentop
    Author

    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.

    $PSVersionTable.PSVersion
    Major  Minor  Build  Revision
    -----  -----  -----  --------
    2      0      -1     -1
    

    I did a fresh clone of the Flutter repository (deleted the flutter dir before).

    Run Flutter doctor in PowerShell:

    > flutter doctor
    Die Benennung "\flutter.bat" 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:\Source\flutter\bin\flutter.ps1:29 Zeichen:2
    + & <<<<  $PSScriptRoot\flutter.bat $args
        + CategoryInfo          : ObjectNotFound: (\flutter.bat:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

    The flutter.bat exists. Semms, that the ps-script didn't realize, that this is a call.

    Run Flutter doctor in cmd:

    C:\Source\flutter\bin>flutter doctor
    Checking Dart SDK version...
    Downloading Dart SDK 1.23.0-dev.2.0...
    Unzipping Dart SDK...
    Die Benennung "Expand-Archive" 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:\Source\flutter\bin\internal\update_dart_sdk.ps1:47 Zeichen:15
    + Expand-Archive <<<<  $dartSdkZip -DestinationPath $cachePath
        + CategoryInfo          : ObjectNotFound: (Expand-Archive:String) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    Updating flutter tool...
    Das System kann den angegebenen Pfad nicht finden.
    Das System kann den angegebenen Pfad nicht finden.
    Checking Dart SDK version...
    

    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.

    >$PSVersionTable.PSVersion
    
    Major  Minor  Build  Revision
    -----  -----  -----  --------
    5      0      10586  117
    

    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.

    > flutter doctor
    Updating flutter tool...
    Downloading Material fonts...
    Downloading package sky_engine...
    Downloading windows-x64 tools...
    Downloading android-arm-profile/windows-x64 tools...
    Downloading android-arm-release/windows-x64 tools...
    Downloading android-x86 tools...
    Downloading android-x64 tools...
    Downloading android-arm tools...
    Downloading android-arm-profile tools...
    Downloading android-arm-release tools...
    [√] Flutter (on Windows, channel master)
        • Flutter at C:\Source\flutter
        • Framework revision 0136b965e8 (5 hours ago), 2017-03-07 22:51:05
        • Engine revision f9c1f5fa53
        • Tools Dart version 1.23.0-dev.2.0
    
    [√] Android toolchain - develop for Android devices (Android SDK 25.0.2)
        • Android SDK at C:\Users\jsi\AppData\Local\Android\sdk
        • Platform android-25, build-tools 25.0.2
        • Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    
    [√] Android Studio (version 1.4)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Gradle version 3.2
    
    [-] WebStorm (version 10)
        • Flutter plugin not installed; this adds Flutter specific functionality.
        • For information about managing plugins, see
          https://www.jetbrains.com/help/idea/managing-plugins.html
    
    [-] WebStorm (version 2016.2)
        • Flutter plugin not installed; this adds Flutter specific functionality.
        • For information about managing plugins, see
          https://www.jetbrains.com/help/idea/managing-plugins.html
    
    Error retrieving device properties for ro.build.characteristics.
    [√] Connected devices
        • adb • adb • android-arm • Android null (API null)
    
  7. goderbauer commented on Mar 8, 2017

    @goderbauer
    Member

    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?

  8. jsiedentop commented on Mar 8, 2017

    @jsiedentop
    Author

    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.

  9. added a commit that references this issue on Mar 8, 2017
    e2dccc5
  10. github-actions commented on Sep 5, 2021

    @github-actions

    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 -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-windowsBuilding on or for Windows specifically

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions