【问题标题】:aqueduct : how to solve Bad state: No element error渡槽:如何解决不良状态:无元素错误
【发布时间】:2020-06-26 11:51:02
【问题描述】:

当我按照步骤在Getting Started with Aqueduct 创建新的渡槽项目时,我在创建新项目时出错

错误:

C:\Users\khalifa>aqueduct create store1
-- Aqueduct CLI Version: 3.3.0+1
*** Uncaught error
    Bad state: No element
  **** Stacktrace
  * #0      ListMixin.firstWhere (dart:collection/list.dart:150:5)
  * #1      CLIAqueductGlobal.aqueductPackageRef (package:aqueduct/src/cli/commands/create.dart:342:10)
  * #2      CLIAqueductGlobal.templateDirectory (package:aqueduct/src/cli/commands/create.dart:347:12)
  * #3      CLIAqueductGlobal.getTemplateLocation (package:aqueduct/src/cli/commands/create.dart:351:12)
  * #4      CLITemplateCreator.handle (package:aqueduct/src/cli/commands/create.dart:51:27)
  * #5      CLICommand.process (package:aqueduct/src/cli/command.dart:159:20)
  * <asynchronous suspension>
  * #6      CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #7      main (file:///C:/Users/khalifa/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/aqueduct-3.3.0+1/bin/aqueduct.dart:9:27)
  * #8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
  * #9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
  ****

飞镖的版本是:

Dart VM version: 2.8.4 (stable) (Wed Jun 3 12:26:04 2020 +0200) on "windows_x64"

【问题讨论】:

    标签: dart aqueduct


    【解决方案1】:

    我很确定你还没有完成pub global activate aqueduct

    stackTrace 指向第 342 行

       341 .getGlobalApplications()
       342 .firstWhere((app) => app.name == "aqueduct")
    

    当 Iterable 中没有元素时,firstWhere() 抛出 StateError("No element")

    【讨论】:

    • 我认为你说得对,我认为在 dart 2.8 中中断更改,所以渡槽将无法工作:(多么糟糕的渡槽 hhhhhh
    • Dart VM version: 2.8.4 (stable) 我已成功创建项目。也许问题是 $PATH 中没有 pub 缓存?
    • 我正在使用 windows 。还不知道:
    猜你喜欢
    • 1970-01-01
    • 2018-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多