解
因此,在尝试构建应用程序时,实际上遇到了两个问题。首先是变压器错误。但是,对这篇文章的评论显示了如何修复此错误(删除主目录中的.pub-cache,删除项目目录中的.pub,然后运行pub get和pub cache repair)。
然而,我遇到的第二个问题是剪刀有几个我忘记存在的外部依赖。当我格式化我的机器时,这些依赖项被删除了。一旦我安装了这些,我就能够再次构建项目。
原始问题
目前,我在运行pub build --mode=debug --verbose
时遇到了角度变换器没有加载的问题。
我昨晚格式化了我的机器并重新安装了所有东西。在格式化之前,构建工作正常,但现在它失败了。所以我不知道是什么导致它。
我尝试删除.pub-cache并撤回依赖项。我也尝试过运行pub cache rebuild --verbose
,似乎没有任何错误/与众不同。我不确定我错过了什么。
以下是上述命令的完整输出。
FINE: Pub 1.21.0
IO : Deleting directory build.
FINE: Loading asset environment...
FINE: Initializing barback...
FINE: Serving packages on localhost:0.
MSG : Loading source assets...
FINE: Providing sources for test_project|lib.
FINE: Loading source assets finished (0.060s).
FINE: Provided sources.
FINE: Loading transformers...
FINE: Transformer dependencies:
| scissors: -
| angular2: -
| dart_to_js_script_rewriter: -
| chrome: -
FINE: Using cached transformer snapshot.
MSG : Loading scissors, angular2, dart_to_js_script_rewriter and chrome transformers...
FINE: Loading transformers from [scissors, angular2, dart_to_js_script_rewriter, chrome]
FINE: Spawning isolate from ./.pub/transformers/transformers.snapshot.
FINE: Loading scissors, angular2, dart_to_js_script_rewriter and chrome transformers finished (0.109s).
FINE: Transformers from scissors: {group of [[SassC]]}
ERR : Error on line 18, column 5 of pubspec.yaml: Error loading transformer: Couldn't find library at package:angular2/transformer.dart.
| platform_directives:
| ^^^^^^^^^^^^^^^^^^^^^
FINE: Exception type: TransformerLoadError
FINE: package:pub/src/barback/transformer_isolate.dart 126 TransformerIsolate.create.<async>
| ===== asynchronous gap ===========================
| dart:async _Completer.completeError
| package:pub/src/barback/transformer_isolate.dart 129 TransformerIsolate.create.<async>
| ===== asynchronous gap ===========================
| dart:async _asyncErrorWrapperHelper
| package:pub/src/barback/transformer_isolate.dart TransformerIsolate.create
| package:pub/src/barback/transformer_loader.dart 72 TransformerLoader.transformersFor.<async>
| ===== asynchronous gap ===========================
| dart:async Future.Future.microtask
| package:pub/src/barback/transformer_loader.dart TransformerLoader.transformersFor
| dart:async Future.wait
| package:pub/src/utils.dart 108 waitAndPrintErrors
| package:pub/src/barback/transformer_loader.dart 118 TransformerLoader.transformersForPhases.<async>.<fn>.<async>
| ===== asynchronous gap ===========================
| dart:async Future.wait
| package:pub/src/barback/transformer_loader.dart 117 TransformerLoader.transformersForPhases.<async>
| ===== asynchronous gap ===========================
| dart:async Future.Future.microtask
| package:pub/src/barback/transformer_loader.dart TransformerLoader.transformersForPhases
| package:pub/src/barback/load_all_transformers.dart 92 loadAllTransformers.<async>.<fn>.<async>
| ===== asynchronous gap ===========================
| dart:async Future.wait
| package:pub/src/barback/load_all_transformers.dart 90 loadAllTransformers.<async>
| dart:async _SyncCompleter.complete
| package:pub/src/barback/transformer_loader.dart 61 TransformerLoader.load.<async>
| dart:async _SyncCompleter.complete
| package:pub/src/barback/transformer_isolate.dart 81 TransformerIsolate.spawn.<async>
| ===== asynchronous gap ===========================
| dart:async _asyncThenWrapperHelper
| package:pub/src/barback/load_all_transformers.dart loadAllTransformers
| package:pub/src/barback/asset_environment.dart 503 AssetEnvironment._load.<fn>.<async>.<fn>.<async>.<fn>.<async>
| ===== asynchronous gap ===========================
| package:pub AssetEnvironment._load.<fn>.<async>.<fn>.<async>.<fn>
| package:pub/src/log.dart 408 progress
| package:pub/src/barback/asset_environment.dart 502 AssetEnvironment._load.<fn>.<async>.<fn>.<async>
| ===== asynchronous gap ===========================
| dart:async Future.Future.sync
| package:pub/src/barback/asset_environment.dart 662 AssetEnvironment._withStreamErrors
| package:pub/src/barback/asset_environment.dart 501 AssetEnvironment._load.<fn>.<async>
| dart:async _SyncCompleter.complete
| package:pub/src/barback/asset_environment.dart 663 AssetEnvironment._withStreamErrors.<fn>
| dart:async _SyncCompleter.complete
| package:pub/src/barback/asset_environment.dart 522 AssetEnvironment._provideSources.<async>
| dart:async _SyncCompleter.complete
| package:pub/src/barback/asset_environment.dart 521 AssetEnvironment._provideSources.<async>.<fn>.<async>
| ===== asynchronous gap ===========================
| dart:async _asyncThenWrapperHelper
| package:pub/src/barback/asset_environment.dart AssetEnvironment._load.<fn>
| package:pub/src/log.dart 408 progress
| package:pub/src/barback/asset_environment.dart 450 AssetEnvironment._load
| package:pub/src/barback/asset_environment.dart 82 AssetEnvironment.create.<fn>.<async>
| ===== asynchronous gap ===========================
| dart:async Future.Future.microtask
| package:pub/src/barback/asset_environment.dart AssetEnvironment.create.<fn>
| package:pub/src/log.dart 408 progress
| package:pub/src/barback/asset_environment.dart 74 AssetEnvironment.create
| package:pub/src/command/build.dart 65 BuildCommand.onRunTransformerCommand.<async>
| ===== asynchronous gap ===========================
| dart:async Future.Future.microtask
| package:pub/src/command/build.dart BuildCommand.onRunTransformerCommand
| package:pub/src/command/barback.dart 56 BarbackCommand.run
| package:args/command_runner.dart 177 CommandRunner.runCommand.<fn>
| dart:async Future.Future.sync
| package:args/command_runner.dart 130 CommandRunner.runCommand
| package:pub/src/command_runner.dart 128 PubCommandRunner.runCommand.<async>.<fn>
| dart:async Future.Future.sync
| package:pub/src/utils.dart 72 captureErrors.<fn>
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 86 captureErrors
| package:pub/src/command_runner.dart 128 PubCommandRunner.runCommand.<async>
| dart:async _SyncCompleter.complete
| package:pub/src/command_runner.dart 214 PubCommandRunner._validatePlatform.<async>
FINE: Wrapped exception: Couldn't find library at package:angular2/transformer.dart.
| package:$pub/transformer_isolate.dart 86 _initialize
| package:$pub/transformer_isolate.dart 28 loadTransformers.<fn>.<fn>
| package:$pub/serialize.dart 159 respond.<fn>
| dart:async/future.dart 168 Future.Future.sync
| package:$pub/serialize.dart 159 respond
| package:$pub/transformer_isolate.dart 25 loadTransformers.<fn>
| dart:async/zone.dart 1338 _RootZone.runUnaryGuarded
| dart:async/stream_impl.dart 331 _BufferingStreamSubscription._sendData
| dart:async/stream_impl.dart 258 _BufferingStreamSubscription._add
| dart:async/stream_controller.dart 768 _StreamController&&_SyncStreamControllerDispatch._sendData
| dart:async/stream_controller.dart 635 _StreamController._add
| dart:async/stream_controller.dart 581 _StreamController.add
| dart:isolate-patch/isolate_patch.dart 148 _RawReceivePortImpl._handleMessage
|
| package:$pub/transformer_isolate.dart 86 _initialize
| package:$pub/transformer_isolate.dart 28 loadTransformers.<fn>.<fn>
| package:$pub/serialize.dart 159 respond.<fn>
| dart:async/future.dart 168 Future.Future.sync
| package:$pub/serialize.dart 159 respond
| package:$pub/transformer_isolate.dart 25 loadTransformers.<fn>
| dart:async/zone.dart 1338 _RootZone.runUnaryGuarded
| dart:async/stream_impl.dart 331 _BufferingStreamSubscription._sendData
| dart:async/stream_impl.dart 258 _BufferingStreamSubscription._add
| dart:async/stream_controller.dart 768 _StreamController&&_SyncStreamControllerDispatch._sendData
| dart:async/stream_controller.dart 635 _StreamController._add
| dart:async/stream_controller.dart 581 _StreamController.add
| dart:isolate-patch/isolate_patch.dart 148 _RawReceivePortImpl._handleMessage
FINE: Transformers from dart_to_js_script_rewriter: {DartToJsScriptRewriter}
FINE: Transformers from chrome: {Chrome}
FINE: Loading transformers finished (0.673s).
FINE: Initializing barback finished (0.785s).
FINE: Loading asset environment finished (0.974s).
这是pubspec.yaml
name: temp_project
description: A Dart app that uses Angular 2
version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: any
chrome: any
http: any
dev_dependencies:
scissors: ^0.6.6
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
- scissors:
verbose: true
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
resolved_identifiers:
BrowserClient: 'package:http/browser_client.dart'
- dart_to_js_script_rewriter
- chrome