我正在尝试运行一个有角度的网页应用。我克隆了已确认的工作项目,但是当我运行pub get
时出现以下错误:
/usr/lib/dart/bin/pub get
Resolving dependencies...
Got dependencies!
Precompiling dependencies...
Loading source assets...
Loading angular, sass_builder and dart_to_js_script_rewriter transformers...
Error on line 26, column 5 of ../../.pub-cache/hosted/pub.dartlang.org/angular_components-0.8.0/pubspec.yaml: Error loading transformer: 'package:sass_builder/sass_builder.dart': malformed type: line 34 pos 20: cannot resolve class 'Logger' from 'SassBuilder'
final _log = new Logger('sass_builder');
^
outputExtension: .scss.css
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Process finished with exit code 0
我的pub.yaml
:
name: ZwinnexD
description: A web app that is a web app
version: 0.21.37
#homepage: https://www.example.com
#author: Kod Schrödingera <email@example.com>
environment:
sdk: '>=1.24.0 <2.0.0'
dependencies:
angular: ^4.0.0
angular_components: ^0.8.0
firebase: ^4.0.0
dev_dependencies:
angular_test: ^1.0.0
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
test: ^0.12.0
transformers:
- angular:
entry_points:
- web/main.dart
- test/**_test.dart
- test/pub_serve:
$include: test/**_test.dart
- dart_to_js_script_rewriter
# Uncomment the following in sdk 1.24+ to make pub serve
# use dartdevc (webdev.dartlang.org/tools/dartdevc).
#web:
# compiler:
# debug: dartdevc
我正在使用飞镖1.24.3 我尝试删除pub-cache,进行缓存修复,甚至重新安装Dart。什么都没有帮助。我在Ubuntu 16.04上工作。请帮忙。
我还可以确认WebStorm的基本项目也不起作用。除了卸载和安装dart之外,我不知道该怎么办...
答案 0 :(得分:6)
到目前为止,我已经发现在pub-cache中编辑SassBuilder
类可以解决问题。您只需要从此
import 'package:logging/logging.dart';
到此:
import 'package:logging/logging.dart' as Log;
并且还改变了logger构造函数:
final _log = new Logger('sass_builder');
到此:
final _log = new Log.Logger('sass_builder');
我现在不知道更好的解决方案。
答案 1 :(得分:3)
这是sass-builder中的问题。要解决此问题,请在 pubspec.yaml 中使用sass_builder: ^1.1.5
或更高版本。这是pull request修复。
答案 2 :(得分:0)
同时,您可以将sass 1.0.0-beta.5.3
添加到pubspec.yaml
并运行pub get
dependency_overrides:
sass: 1.0.0-beta.5.3