Why i can run flutter command in linux terminal, but not in vscode terminal?

Viewed 20

I use ZorinOS. I installed flutter and run flutter doctor, and everything is fine. I created new flutter project and run flutter doctor from command pallete in vscode and i get:

[flutter] flutter doctor -v
[✓] Flutter (Channel stable, 3.3.2, on Freedesktop.org 21.08.15 (Flatpak runtime) 5.15.0-46-generic, locale en_US.UTF-8)
    • Flutter version 3.3.2 on channel stable at /home/lock_rr/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (27 hours ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/lock_rr/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /home/lock_rr/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

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

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/lock_rr/android-studio
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Freedesktop.org 21.08.15 (Flatpak runtime) 5.15.0-46-generic

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
exit code 0

But when i run flutter doctor in my linux terminal, i get a different output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.2, on Zorin OS 16.1 5.15.0-46-generic, locale
    en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

When i try to run flutter run in vscode terminal, i get:

sh-5.1$ flutter run
sh: flutter: command not found

But i can run it with command pallete and linux terminal.I try to use bash in my vscode terminal but nothing changed. So how can i fix this?

Note: instead of chrome,i fill my CHROME_EXECUTABLE with chromium. But it's not detected as issue when i run flutter doctor at linux terminal.

Edit: i try to reinstall flutter, but still can't access it. But i try which flutter in my vscode terminal and got:

sh-5.1$ which flutter
which: no flutter in (/app/bin:/app/bin:/app/bin:/usr/bin:/home/lock_rr/.var/app/com.visualstudio.code/data/node_modules/bin)
1 Answers

So after some trial and error. i found that the source of my problem was my vscode. I installed vscode from the linux software store and it didn't work. I reinstalled from the vscode website and it worked

Related