【问题标题】:The term '' is not recognized as the name of a cmdlet, function, script file术语 \'\' 未被识别为 cmdlet、函数、脚本文件的名称
【发布时间】:2022-09-27 17:03:10
【问题描述】:

我对编码很陌生并且遇到了这个问题,无法理解如何解决它,我看到过类似的问题,但是我无法理解其中的大多数。我试过添加 该路径几次,甚至重新安装了Vscode它似乎没有解决。

我写的代码::

import \'dart:io\';

void main() {
  print(\"Enter your name\");
  var name = stdin.readLineSync();
  print(\"The name is $name\");
}

我得到的错误是:


Jack : The term \'Jack\' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Jack
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (Jack:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我努力了:

1:再次设置路径

2:重新安装vs代码。

任何类型的信息都会真正有帮助,因此我无法真正进步。

  • 你能发布你的完整代码吗?
  • 那是整个代码还是我不理解其中的一部分。

标签: flutter dart visual-studio-code


【解决方案1】:

你是如何运行你的程序的?当我使用您的确切代码编写程序时,它可以工作。

你已经在 Dart 中编写了一个命令行脚本,因此需要运行它。例如,如果您将程序保存在文件my_app.dart 中,那么您可以从命令行运行dart my_app.dart,它将运行您的脚本。

运行它的另一种方法是创建一个 dart 控制台应用程序并使用dart run 运行它,如下所述:https://dart.dev/tutorials/server/get-started。这将是我的建议,如果您遵循指南,我认为您将能够弄清楚,但要快速确认您的代码有效,您可以执行第一个建议。

【讨论】:

  • 第一种方法是我如何做到的,它仍然无法正常工作,请查看您提到的另一种方法。
  • 你是直接从终端在 vs 代码中运行它吗? Ia它bash?
  • 好吧,我,运行代码并在终端中输入名称。
  • 直接在Vscode中。我认为。
  • 您的错误看起来很像 PowerShell,而不是 bash,这可能是问题所在
【解决方案2】:

2022-09-27 :术语“▬▬▬▬2022-09-27”未被识别为 cmdlet、函数、脚本文件或 可运行的程序。检查名称的拼写,或者如果包含路径,请验证路径是否正确并 再试一次。 在行:1 字符:1 请回答

【讨论】:

    猜你喜欢
    • 2021-12-23
    • 2015-12-10
    • 2021-03-04
    • 1970-01-01
    • 2017-08-11
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 2022-08-19
    相关资源
    最近更新 更多