[英]Why i can run flutter command in linux terminal, but not in vscode terminal?
我使用 ZorinOS。 我安裝了 flutter 並運行 flutter 博士,一切都很好。 我創建了新的 flutter 項目並從 vscode 中的命令托盤運行 flutter 醫生,我得到:
[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
但是當我在我的 linux 終端中運行 flutter 醫生時,我得到了不同的 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!
當我嘗試在 vscode 終端中運行 flutter 時,我得到:
sh-5.1$ flutter run
sh: flutter: command not found
但我可以使用命令pallete 和linux 終端運行它。我嘗試在我的vscode 終端中使用bash 但沒有任何改變。 那么我該如何解決這個問題?
注意:我用鉻填充我的 CHROME_EXECUTABLE 而不是鉻。 但是當我在 linux 終端運行 flutter 醫生時,它沒有被檢測為問題。
編輯:我嘗試重新安裝 flutter,但仍然無法訪問它。 但是我在我的 vscode 終端中嘗試which flutter
並得到了:
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)
所以經過一些試驗和錯誤。 我發現我的問題的根源是我的 vscode。 我從 linux 軟件商店安裝了 vscode,它沒有工作。 我從 vscode 網站重新安裝,它工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.