Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL: running/installing flutter from master fails. #41742

Closed
JordanMajd opened this issue Oct 1, 2019 · 20 comments
Closed

WSL: running/installing flutter from master fails. #41742

JordanMajd opened this issue Oct 1, 2019 · 20 comments
Labels
platform-windows Building on or for Windows specifically tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@JordanMajd
Copy link

JordanMajd commented Oct 1, 2019

Using WSL on Windows 10 I am unable to run/install flutter via the master channel; whereas I have no issues with the latest stable release. Running any flutter command from master fails with:

Building flutter tool...
Connection closed while receiving data
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)

I've reviewed similar issues, however none produced satisfactory results. I tried reproducing the issue directly on an Ubuntu server and everything ran fine; it would seem it is a WSL related issue.

System Information

System information:

  • Windows 10 Pro 1809 17763.737
  • Linux <Hostname> 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

Steps to Reproduce

Before either I ensured I had prerequisites installed and my system fully upgraded:

sudo apt update
sudo apt upgrade
sudo apt install curl git unzip xz-utils libglu1-mesa curl

Method One: SDK Install

wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.9.1+hotfix.4-stable.tar.xz
tar xvf flutter_linux_v1.9.1+hotfix.4-stable.tar.xz

# flutter commands work now
./flutter/bin/flutter config --no-analytics # this should be the default setting btw
./flutter/bin/flutter --version

# lets switch over to master
./flutter/bin/flutter channel master

# fails
./flutter/bin/flutter upgrade

# any flutter command will now fail since  switching to master channel
./flutter/bin/flutter --version # fails
./flutter/bin/flutter doctor # fails

Method Two: Git Install

git clone -b master https://github.com/flutter/flutter.git

# any flutter command will now fail:
./flutter/bin/flutter --version
./flutter/bin/flutter upgrade
./flutter/bin/flutter doctor

Logs

Method One Logs:

$ git clone -b master https://github.com/flutter/flutter.git
$ ./flutter/bin/flutter --version
Downloading Dart SDK from Flutter engine 49815128157d80803da9f36c69493b2a09aacd03...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  259M  100  259M    0     0  29.9M      0  0:00:08  0:00:08 --:--:-- 31.5M
Building flutter tool...
Connection closed while receiving data
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
Connection closed while receiving data
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
#... just keeps failing

Method Two Logs:

$ wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.9.1+hotfix.4-stable.tar.xz
$ tar xvf flutter_linux_v1.9.1+hotfix.4-stable.tar.xz
# ... long but nominal output
$ ./flutter/bin/flutter --version
Flutter 1.9.1+hotfix.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision cc949a8e8b (4 days ago) • 2019-09-27 15:04:59 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0
$ ./flutter/bin/flutter channel master
Switching to flutter channel 'master'...
git: From https://github.com/flutter/flutter
git:  * [new branch]          dnfield-patch-1 -> origin/dnfield-patch-1
git:  * [new branch]          jiahaog-manual-roll-engine -> origin/jiahaog-manual-roll-engine
git:    2de1e4f4a..c9d920f30  master          -> origin/master
git: Switched to a new branch 'master'
git: Branch 'master' set up to track remote branch 'master' from 'origin'.
$ ./flutter/bin/flutter upgrade
Downloading Dart SDK from Flutter engine 49815128157d80803da9f36c69493b2a09aacd03...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  259M  100  259M    0     0  29.8M      0  0:00:08  0:00:08 --:--:-- 30.7M
Building flutter tool...
Connection closed while receiving data
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
Connection closed while receiving data
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
# ... just keeps failing
@JordanMajd JordanMajd changed the title WSL: flutter-tool from master fails. WSL: running/installing flutter from master fails. Oct 1, 2019
@BondarenkoStas BondarenkoStas added the platform-windows Building on or for Windows specifically label Oct 1, 2019
@efrainmunoz
Copy link

efrainmunoz commented Oct 1, 2019

Same problem on MacOS Mojave 10.14.6
Screen Shot 2019-10-01 at 7 25 33 PM

@kevin-sakemaer
Copy link

kevin-sakemaer commented Oct 14, 2019

It also fail if you do this :

$ git clone -b stable [email protected]:flutter/flutter.git
$ flutter --version
Building flutter tool
Connection closed while receiving data
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
...

so it's not only on master.

@silvanocerza
Copy link

I had the same problem on WSL, solved by adding /usr/lib/dart/bin to PATH. Might not be the same problem though.

@pothos-dev
Copy link

I got the same problem (WSL2 on Windows 10), adding dart to PATH did not help.

@LuckierDodge
Copy link

Also seeing this issue (WSL1 on W10).

@ilyoungkim
Copy link

Not working flutter(WSL1 on W10).

user@DESKTOP-ISVFPRU:~/flutter$ flutter
/mnt/d/dev/flutter/bin/flutter: line 5: $'\r': command not found
/mnt/d/dev/flutter/bin/flutter: line 6: $'\r': command not found
/mnt/d/dev/flutter/bin/flutter: line 14: $'\r': command not found
: invalid optioner/bin/flutter: line 15: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/mnt/d/dev/flutter/bin/flutter: line 16: $'\r': command not found
': not a valid identifierutter: line 17: unset: CDPATH /mnt/d/dev/flutter/bin/flutter: line 18: $'\r': command not found /mnt/d/dev/flutter/bin/flutter: line 19: syntax error near unexpected token $'{\r''
'mnt/d/dev/flutter/bin/flutter: line 19: `function follow_links() {

@CXZ7720
Copy link

CXZ7720 commented Dec 20, 2019

I have same issue with @ilyoungkim .

@VladyslavBondarenko VladyslavBondarenko added the tool Affects the "flutter" command-line tool. See also t: labels. label Jan 16, 2020
@coolbeatz71
Copy link

Hey, @ilyoungkim @CXZ7720 I had the same problem too, It happens because you probably installed a windows copy of flutter but trying to run it inside WSL which a Linux environment. You should consider installing the Linux copy too

@CXZ7720
Copy link

CXZ7720 commented May 23, 2020

Hello, @coolbeatz71.
I didn't installed windows copy of flutter.
I just installed new build of flutter_linux_1.17.1-stable.tar.xz.

Here's full copy of WSL console.
Sadly until now, it just print out errors.

kygha7205@DESKTOP-1T1AT4I:~$ wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.17.1-stable.tar.xz
--2020-05-24 02:58:07--  https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.17.1-stable.tar.xz
Resolving storage.googleapis.com (storage.googleapis.com)... 172.217.175.112, 2404:6800:4004:80d::2010
Connecting to storage.googleapis.com (storage.googleapis.com)|172.217.175.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 474030432 (452M) [application/x-gtar]
Saving to: ‘flutter_linux_1.17.1-stable.tar.xz’

flutter_linux_1.17.1-stable.t 100%[=================================================>] 452.07M  7.04MB/s    in 58s

2020-05-24 02:59:06 (7.74 MB/s) - ‘flutter_linux_1.17.1-stable.tar.xz’ saved [474030432/474030432]

kygha7205@DESKTOP-1T1AT4I:~$ tar xf flutter_linux_1.17.1-stable.tar.xz
kygha7205@DESKTOP-1T1AT4I:~$ ls
flutter  flutter_linux_1.17.1-stable.tar.xz  flutter_linux_v1.12.13+hotfix.5-stable.tar.xz
kygha7205@DESKTOP-1T1AT4I:~$ cd flutter
kygha7205@DESKTOP-1T1AT4I:~/flutter$ ls
AUTHORS     CODE_OF_CONDUCT.md  LICENSE       README.md              bin                   dev       flutter_console.bat  packages
CODEOWNERS  CONTRIBUTING.md     PATENT_GRANT  analysis_options.yaml  dartdoc_options.yaml  examples  flutter_root.iml     version
kygha7205@DESKTOP-1T1AT4I:~/flutter$ export PATH="$PATH:`pwd`/flutter/bin"

kygha7205@DESKTOP-1T1AT4I:~/flutter$ flutter doctor
/mnt/c/src/flutter/bin/flutter: line 5: $'\r': command not found
/mnt/c/src/flutter/bin/flutter: line 6: $'\r': command not found
/mnt/c/src/flutter/bin/flutter: line 14: $'\r': command not found
: invalid optioner/bin/flutter: line 15: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/mnt/c/src/flutter/bin/flutter: line 16: $'\r': command not found
': not a valid identifierutter: line 17: unset: `CDPATH
/mnt/c/src/flutter/bin/flutter: line 18: $'\r': command not found
/mnt/c/src/flutter/bin/flutter: line 19: syntax error near unexpected token `$'{\r''
'mnt/c/src/flutter/bin/flutter: line 19: `function follow_links() {
kygha7205@DESKTOP-1T1AT4I:~/flutter$

@0x0bloodyknight
Copy link

0x0bloodyknight commented May 24, 2020

Hello, @coolbeatz71.
I didn't installed windows copy of flutter.
I just installed new build of flutter_linux_1.17.1-stable.tar.xz.

Here's full copy of WSL console.
Sadly until now, it just print out errors.

kygha7205@DESKTOP-1T1AT4I:~$ wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.17.1-stable.tar.xz
--2020-05-24 02:58:07--  https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.17.1-stable.tar.xz
Resolving storage.googleapis.com (storage.googleapis.com)... 172.217.175.112, 2404:6800:4004:80d::2010
Connecting to storage.googleapis.com (storage.googleapis.com)|172.217.175.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 474030432 (452M) [application/x-gtar]
Saving to: ‘flutter_linux_1.17.1-stable.tar.xz’

flutter_linux_1.17.1-stable.t 100%[=================================================>] 452.07M  7.04MB/s    in 58s

2020-05-24 02:59:06 (7.74 MB/s) - ‘flutter_linux_1.17.1-stable.tar.xz’ saved [474030432/474030432]

kygha7205@DESKTOP-1T1AT4I:~$ tar xf flutter_linux_1.17.1-stable.tar.xz
kygha7205@DESKTOP-1T1AT4I:~$ ls
flutter  flutter_linux_1.17.1-stable.tar.xz  flutter_linux_v1.12.13+hotfix.5-stable.tar.xz
kygha7205@DESKTOP-1T1AT4I:~$ cd flutter
kygha7205@DESKTOP-1T1AT4I:~/flutter$ ls
AUTHORS     CODE_OF_CONDUCT.md  LICENSE       README.md              bin                   dev       flutter_console.bat  packages
CODEOWNERS  CONTRIBUTING.md     PATENT_GRANT  analysis_options.yaml  dartdoc_options.yaml  examples  flutter_root.iml     version
kygha7205@DESKTOP-1T1AT4I:~/flutter$ export PATH="$PATH:`pwd`/flutter/bin"

kygha7205@DESKTOP-1T1AT4I:~/flutter$ flutter doctor
/mnt/c/src/flutter/bin/flutter: line 5: $'\r': command not found
/mnt/c/src/flutter/bin/flutter: line 6: $'\r': command not found
/mnt/c/src/flutter/bin/flutter: line 14: $'\r': command not found
: invalid optioner/bin/flutter: line 15: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/mnt/c/src/flutter/bin/flutter: line 16: $'\r': command not found
': not a valid identifierutter: line 17: unset: `CDPATH
/mnt/c/src/flutter/bin/flutter: line 18: $'\r': command not found
/mnt/c/src/flutter/bin/flutter: line 19: syntax error near unexpected token `$'{\r''
'mnt/c/src/flutter/bin/flutter: line 19: `function follow_links() {
kygha7205@DESKTOP-1T1AT4I:~/flutter$

It says you are running flutter from /mnt/c/src/flutter/bin.
Can you provide the echo $PATH output from wsl?
You can try the following workaround: microsoft/WSL#1493 (comment)

@CXZ7720
Copy link

CXZ7720 commented May 28, 2020

It says you are running flutter from /mnt/c/src/flutter/bin.
Can you provide the echo $PATH output from wsl?
You can try the following workaround: microsoft/WSL#1493 (comment)

Oh, I See. Thanks for your comment.
I realized that there are mixed value of windows and linux value at $PATH.
I followed instruction of the comment. microsoft/WSL#1493 (comment)

After I changed my registry value from 7 to 5, echo $PATH output shows only Linux values.

kygha7205@DESKTOP-1T1AT4I:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/kygha7205/flutter/bin

But, unfortunately, every flutter command doesn't work. It only prints like this.

kygha7205@DESKTOP-1T1AT4I:~$ flutter --version
Unhandled exception:
OS Error: Connection refused, errno = 111
kygha7205@DESKTOP-1T1AT4I:~$ flutter doctor -v
Unhandled exception:
OS Error: Connection refused, errno = 111

In this case, I think WSL found right linux binaries, but there are some OS specific problems.

@ljieyao
Copy link

ljieyao commented Jun 6, 2020

It says you are running flutter from /mnt/c/src/flutter/bin.
Can you provide the echo $PATH output from wsl?
You can try the following workaround: microsoft/WSL#1493 (comment)

Oh, I See. Thanks for your comment.
I realized that there are mixed value of windows and linux value at $PATH.
I followed instruction of the comment. microsoft/WSL#1493 (comment)

After I changed my registry value from 7 to 5, echo $PATH output shows only Linux values.

kygha7205@DESKTOP-1T1AT4I:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/kygha7205/flutter/bin

But, unfortunately, every flutter command doesn't work. It only prints like this.

kygha7205@DESKTOP-1T1AT4I:~$ flutter --version
Unhandled exception:
OS Error: Connection refused, errno = 111
kygha7205@DESKTOP-1T1AT4I:~$ flutter doctor -v
Unhandled exception:
OS Error: Connection refused, errno = 111

In this case, I think WSL found right linux binaries, but there are some OS specific problems.

how u solve this?

@fcioffi
Copy link

fcioffi commented Jun 10, 2020

interested too

@ConfidenceYobo
Copy link

It says you are running flutter from /mnt/c/src/flutter/bin.
Can you provide the echo $PATH output from wsl?
You can try the following workaround: microsoft/WSL#1493 (comment)

Oh, I See. Thanks for your comment.
I realized that there are mixed value of windows and linux value at $PATH.
I followed instruction of the comment. microsoft/WSL#1493 (comment)

After I changed my registry value from 7 to 5, echo $PATH output shows only Linux values.

kygha7205@DESKTOP-1T1AT4I:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/kygha7205/flutter/bin

But, unfortunately, every flutter command doesn't work. It only prints like this.

kygha7205@DESKTOP-1T1AT4I:~$ flutter --version
Unhandled exception:
OS Error: Connection refused, errno = 111
kygha7205@DESKTOP-1T1AT4I:~$ flutter doctor -v
Unhandled exception:
OS Error: Connection refused, errno = 111

In this case, I think WSL found right linux binaries, but there are some OS specific problems.

Am also interested in how you solved the issue and what kind of OS specific problems could cause the issue

@margaiwangara
Copy link

margaiwangara commented Sep 28, 2020

I finally managed to find a solution to this problem, posting this here for anyone who hasn't found this yet. If you are using zsh you can add the below command in ~/.bashrc file, those using oh-my-zsh add the command to your ~/.zshrc file.

flutter(){
  command CMD.exe /c flutter $@
}

You can then source the file source ~/.bashrc or ~/.zshrc then just run flutter doctor, it will work the same as on windows.

@mymultiverse
Copy link

I finally managed to find a solution to this problem, posting this here for anyone who hasn't found this yet. If you are using zsh you can add the below command in ~/.bashrc file, those using oh-my-zsh add the command to your ~/.zshrc file.

flutter(){
  command CMD.exe /c flutter $@
}

You can then source the file source ~/.bashrc or ~/.zshrc then just run flutter doctor, it will work the same as on windows.

Yes, this worked for me.

@theodoremca
Copy link

I finally managed to find a solution to this problem, posting this here for anyone who hasn't found this yet. If you are using zsh you can add the below command in ~/.bashrc file, those using oh-my-zsh add the command to your ~/.zshrc file.

flutter(){
  command CMD.exe /c flutter $@
}

You can then source the file source ~/.bashrc or ~/.zshrc then just run flutter doctor, it will work the same as on windows.

this works thank so much

@darshankawar
Copy link
Member

@JordanMajd
Can you confirm if you are still facing the issue using latest stable / master version of the framework ?
An update would be good to have so that we can update this issue accordingly.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 18, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

@github-actions github-actions bot closed this as completed Nov 8, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-windows Building on or for Windows specifically tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests