Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么我不能在 cmd 上运行dart main.dart而不是在 Visual Studio Code 的终端上运行?我什至无法更改目录。
这里的终端输出:
在您键入的第一个命令中cd \bin,它试图bin从您的根目录中查找一个文件夹。您应该刚刚使用过cd bin(尽管dart bin/main.dart从根目录运行可能会更好)。
cd \bin
bin
cd bin
dart bin/main.dart
在第二个命令中,路径中有一个空格,因此您需要在整个路径周围加上引号。
也就是说,您可能会发现使用 VS Code 中的“运行”菜单(例如按 F5)运行您的应用程序会更好,因为这样您将获得完整的调试器支持。