【问题标题】:Build failed - Check imports - Dart Angular Tutorial - angular_tour_of_heroes - part 2构建失败 - 检查导入 - Dart Angular 教程 - angular_tour_of_heroes - 第 2 部分
【发布时间】:2019-02-05 10:42:53
【问题描述】:

在关注教程时 - Angular-dart tutorial - Tour of Heroes - part 2

在使用 chrome 时在 Windows 10 中使用 IntelliJ IDEA,出现以下错误 -

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

Please check the following imports:

import 'package:angular_app/app_component.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1

[SEVERE] Failed after 1.3s Serving web on http://localhost:53323

我已经检查了多次,我已经替换了所有 - 5 个文件 - 即 lib/app_component.css, lib/app_component.dart, lib/app_component.html, lib/src/hero.dart & lib/src/mock_heroes.dart 来自 Review the app structure 但我仍然收到上述错误 & -

  1. 我找不到任何app_component.template.dart

  2. 使用 IntelliJ 在路径中查找 (Ctrl+Shift+F) 也找不到导入的 package:angular_app/app_component.css.shim.dartshim 的任何实例

  3. 我已尝试删除构建并重新构建。

  4. 我还使用 windows 包管理器重新安装了 dart 2.1.0 并在 IntelliJ IDEA 设置/Dart 中相应地更改了 dart-sdk 的位置,因为在短时间内我收到了 dart-sdk 错误,但是是固定的。


这是我第一次在 stacksoverflow 上提出问题,但我检查了类似的问题,无法解决该问题。

【问题讨论】:

    标签: dart angular-dart


    【解决方案1】:

    构建失败的最可能原因是未找到 stylesUrls 文件。这可能是因为该数组中的名称与文件系统中的名称不匹配,或者不是文件系统中的预期位置。

    为了确认,我从头开始,下载了 quickstart-master.zip 以获取项目结构。 并一直按照步骤完成您被卡住的步骤。 在执行这些步骤时,我唯一一次能够生成该错误是我在创建文件之前将styleUrls: ['app_component.css'], 添加到app_component.dart

    我也一样:

    [严重] build_web_compilers|test/app_test.dart.browser_test.dart 上的入口点: 无法找到某些源的模块,这通常是由于 导入错误,包中缺少依赖项(或者可能是 dev_dependency 需要移动到真正的依赖项),或构建失败(如果导入 生成的文件)。

    请检查以下导入:

    import 'package:angular_app/app_components.css.shim.dart' as import0; 来自 angular_app|lib/app_component.template.dart 在 12:1

    一旦我创建了 css 文件,错误就消失了,一切正常。 我完成了您要完成的整个步骤,并且我的应用程序运行良好。 然后我像你一样做了,并从步骤中复制了每个文件并用它替换了我的工作,仍然有效。 所以确认我的预感,我更改了 css 文件的名称,并收到了同样的错误。

    关于app_component.template.dart,该文件是由dart自动生成的,可以在.dart_tool/build/generated/angular_app/lib下的项目中找到

    【讨论】:

      【解决方案2】:

      我有一个非常相似的问题。我运行了webdev build,然后运行webdev serve,它就修复了它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-09-11
        • 2017-03-06
        • 2019-10-16
        • 2016-06-23
        • 2022-11-30
        • 1970-01-01
        • 2017-08-11
        • 1970-01-01
        相关资源
        最近更新 更多