我一直在关注Dart Angular Tour of Heroes tutorial。我到了第5部分,在那里讲授了路由。但是我被困在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
要纠正我尝试过的错误:
pubspec.yaml
是正确的。pub get
以及运行pub upgrade
。谢谢。
答案 0 :(得分:3)
抱歉,我尚未完成本教程,但是app_component是在本教程前面创建的文件。 angular_tour_of_heroes
是示例中使用的程序包名称。
因此,对于您自己的教程,您想使用:
import 'package:USE_YOUR_PACKAGE_NAME/app_component.template.dart' as ng;
用USE_YOUR_PACKAGE_NAME
下pubspec.yaml
文件中的名称替换name: USE_YOUR_PACKAGE_NAME