gpt4 book ai didi

dart - 升级到 Dart2/Angular5 导入 template.dart 时出错

转载 作者:行者123 更新时间:2023-12-04 23:03:11 25 4
gpt4 key购买 nike

我正在将我的 dart/angular 项目升级到 dart 2.x/angular 5.x。 phpstorm 中的示例有效,但是当我构建项目时,出现以下错误:

[SEVERE] build_modules|modules on lib/app_component.template.dart:

Bad state: No element
[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:mfgapp/app_component.template.dart' as ng;` from mfgapp|web/main.template.dart at 8:1
`import 'package:mfgapp/app_component.template.dart' as ng;` from mfgapp|web/main.dart at 1:1

我用指导方针迁移了项目,dart 分析没有显示任何错误

这是我的一些文件:
main.dart
import 'package:angular/angular.dart';
import 'package:mfgapp/app_component.template.dart' as ng;

void main() {
runApp(ng.AppComponentNgFactory);
}

app_component.dart
import 'package:angular/angular.dart';


@Component(
selector: 'mfgapp',
styleUrls: ['package:angular_components/src/components/app_layout/layout.scss.css', 'layout.css', 'app_component.css'],
templateUrl: 'app_component.html',
)


class AppComponent {

}

pubspec.yaml:
name: mfgapp
description: A web app that uses AngularDart Components

environment:
sdk: '>=2.0.0-dev.68.0 <3.0.0'

dependencies:
angular: ^5.0.0-beta
angular_components: ^0.9.0-beta

dev_dependencies:
angular_test: ^2.0.0-beta
build_runner: ^0.9.0
build_test: ^0.10.2
build_web_compilers: ^0.4.0
test: ^1.0.0

我减少了代码以指示错误,但没有任何变化。即使我删除了 import 语句,我也会收到 app_component.template.dart as ref1 无法导入的错误。

最佳答案

对我来说同样的问题。清理项目解决了这个问题。

pub cache repair

关于dart - 升级到 Dart2/Angular5 导入 template.dart 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51555733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com