路由 Dart 时无法找到模块 Angular 英雄之旅

Unable to find modules when routing Dart Angular Tour of Heroes

我一直在关注Dart Angular Tour of Heroes tutorial. I made it to part 5, where routing is taught. But I got stuck at the section where the router is made available。我输入了代码,但它没有构建。我收到以下错误:

[SEVERE] build_web_compilers|entrypoint on web/main.dart:
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).

Please check the following imports:

`import 'package:angular_tour_of_heroes/app_component.template.dart' as ng;` from angular_app|web/main.template.dart at 10:1
`import 'package:angular_tour_of_heroes/app_component.template.dart' as ng;` from angular_app|web/main.dart at 3:1

修复我试过的错误:

谢谢。

抱歉,我还没有完成本教程,但是 app_component 是本教程前面创建的文件。 angular_tour_of_heroes 是示例中使用的包名称。

因此,对于您自己的教程,您可能希望使用:

import 'package:USE_YOUR_PACKAGE_NAME/app_component.template.dart' as ng;

USE_YOUR_PACKAGE_NAME 替换为 name: USE_YOUR_PACKAGE_NAME

pubspec.yaml 文件中的名称