簡體   English   中英

無法在 VS 代碼中運行 dart 程序

[英]Unable to run a dart program inside VS code

我是 Dart/flutter 的新手。 I have installed flutter SDK and VS Code on windows 10 machine, updated the system path, run flutter doctor, which shows that flutter is indeed installed ( flutter doctor output ). I read that installing flutter is enough, and I don't have to install Dart SDK too, as it comes build in with flutter (please correct me if I am wrong).

我寫了一個非常短的 Dart 代碼進行測試,但我無法從 VS Code 終端運行它(在終端 output 中運行),因為它返回以下錯誤:“bash: ZBB141276789EA20FAE97D873900 找不到命令”。

但是當我在 VS Code 中調試代碼時,它會返回預期的 output (調試 output )。

如果我做錯了什么,或者我遺漏了什么,有人可以向我解釋一下嗎? 為什么我不能從 bash 終端運行程序?

謝謝

您應該輸入完整路徑目錄而不是文件名。 為此,右鍵單擊 dart 文件,然后選擇Copy Path

在此處輸入圖像描述

然后在終端上運行以下代碼:

dart (paste main file path)

在此處輸入圖像描述

有關使用 VSCode 創建和運行 Dart 控制台應用程序的更多信息,請查看答案。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM