【问题标题】:Angular Dart Tutorial - Unable to find modules for some sourcesAngular Dart 教程 - 无法找到某些源的模块
【发布时间】:2019-02-17 20:39:07
【问题描述】:

我正在尝试遵循 Angular Dart 教程 (https://webdev.dartlang.org/angular/tutorial/toh-pt1),但在添加了一些使用 ngModel 指令的 html 后卡住了。

根据教程,为了使用 ngModel 指令,必须将“angular_forms: ^2.0.0”添加到 pubspec.yaml,导入 'package:angular_forms/angular_forms.dart' 并将“formDirectives”添加到组件指令。我做了所有这些,包括运行“pub get”来获取依赖项,但是当我运行“webdev serve”时,我收到以下错误:

[SEVERE] build_web_compilers|entrypoint on test/app_test.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).

我错过了什么?

【问题讨论】:

  • 我想我遇到了同样的问题。只要您只是按照教程操作并且不使用测试,您可以尝试取消注释所有内容,包括所有包含,除了以下方法:test/app_test.dart 中的 void main() {}。这对我有用。

标签: angular-dart


【解决方案1】:

我也遇到了同样的问题。我不认为它在 tute 中明确提及,但是在将 angular_forms 依赖项添加到 pubspec.yaml 文件后,您需要使用以下方法引入这个新依赖项:

pub get

希望对你有帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-09
    • 2017-02-11
    • 2021-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-08
    • 1970-01-01
    相关资源
    最近更新 更多