11

i'm on Manjaro. i've install google-chrome from AUR and it shows up in flutter doctor , flutter devices when executed from terminal. the problem is when i run flutter doctor from vscode it says

[✗] Chrome - develop for the web (Cannot find chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

T-X
  • 145
  • 1
  • 9

5 Answers5

19

First you need to switch master channel

flutter channel master

Then run

flutter upgrade

Enable Web support by running

flutter config --enable-web

Find installation path of chrome by running

which chrome

set an Environment variable to chrome's installation path. If your installed using AUR it will in /opt/google/chrome/chrome

export CHROME_EXECUTABLE=/opt/google/chrome/chrome

Finally run

flutter devices

You can see chrome as a connected device.

z3r0c00l_2k
  • 1,011
  • 10
  • 9
15

To use chrome or chromium on Linux(Manjaro), first you have to find their location.

Run the following command:

which chromium

My chromium is located at:

/usr/bin/chromium

If you wish to add this browser to Flutter, then you should add it to the CHROME_EXECUTABLE environment variable.

the following command needs to be placed in the .bashrc:

/usr/bin/chromium is my chromium location; add yours.

You can use nano:

nano .bashrc 

Add the following command and press Ctrl+x and then Y to make sure it has been saved.

export CHROME_EXECUTABLE=/usr/bin/chromium 

And finally run:

source .bashrc 

Now restart the previous open IDE and it should work. If you run:

flutter doctor

You should find it in the connected device.

NoobN3rd
  • 1,223
  • 1
  • 9
  • 19
  • While this answer is rather for linux users, for macOS PATH look like this on macOS: `export CHROME_EXECUTABLE=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome` – Paul Kastel Aug 29 '23 at 06:39
4

check $PATH

try to chrome- and tab

ln -s /usr/bin/google-chrome-stable /usr/local/bin/google-chrome
puz_zle
  • 459
  • 5
  • 7
2

run flutter pub global activate webdev

1

If you are using brave browser on Manjaro, open the terminal and start here:

which brave-browser

My brave is located at:

/usr/bin/brave-browser

Then you can run the executable:

export CHROME_EXECUTABLE=/usr/bin/brave-browser

Then you can run flutter devices:

flutter devices

The output of flutter devices should be:

1 connected device:

Chrome (web) • chrome • web-javascript • Brave Browser 96.1.33.80 unknown

Run flutter doctor in verbose:

flutter doctor -v 

Here's the output all green:

[✓] Flutter (Channel master, 2.6.0-12.0.pre.999, on Manjaro Linux
    5.9.16-1-MANJARO, locale en_US.utf8)
    • Flutter version 2.6.0-12.0.pre.999 at /home/mbuso/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 895beb04bb (33 hours ago), 2021-12-10 18:54:10 -0800
    • Engine revision 79f750d4a5
    • Dart version 2.16.0 (build 2.16.0-85.0.dev)
    • DevTools version 2.9.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/mbuso/Android/Sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /opt/android-sdk
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/brave

[✓] Android Studio (version 2020.3)
    • Android Studio at /opt/android-studio
    • Flutter plugin version 62.0.1
    • Dart plugin version 203.8452
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] IntelliJ IDEA Community Edition (version 2021.2)
    • IntelliJ at /usr/share/idea
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Brave Browser 96.1.33.80 unknown

• No issues found!

To make sure that the export executes on every start you can include this line in your ~/.bashrc or ~/.zshrc depending on which shell you use:

export CHROME_EXECUTABLE=/usr/bin/brave-browser
Mbuso
  • 131
  • 1
  • 8
  • 1
    For me, I it didn't worked. I had to add the line export CHROME_EXECUTABLE="/usr/bin/chromium" into home>~./bashrc file. Then it started showing – Rajesh Feb 14 '22 at 11:35
  • 1
    Yeah man...I forgot to include the export CHROME_EXECUTABLE=/usr/bin/brave in the ~/.bashrc or ~/.zshrc. Thank you – Mbuso Feb 15 '22 at 18:51