PWA Worker使用AngularDart

时间:2017-08-28 09:14:55

标签: dart service-worker angular-dart dart-pub

我正在尝试将离线功能添加到角落飞镖项目中,运行pub build

Running pub build:pub.exe build
-----
Unhandled exception:
ProcessException: The system cannot find the file specified.
Command: pub.exe build
#0      _buildProjectIfEmptyOrOld (http://localhost:52940/pwa.dart:116)
<asynchronous suspension>
#1      main (http://localhost:52940/pwa.dart:40)
<asynchronous suspension>
#2      _startIsolate.<anonymous closure> (dart:isolate-
patch/isolate_patch.dart:263)
#3      _RawReceivePortImpl._handleMessage (dart:isolate-
patch/isolate_patch.dart:151)

main.dart

import 'package:angular/angular.dart';
import 'package:my_app/views/app_component/app_component.dart';
import 'package:pwa/client.dart' as pwa;

void main() {
    bootstrap(AppComponent);

    // register PWA ServiceWorker for offline caching.
    new pwa.Client();
}

pubspec.yaml

dependencies:
     pwa: ^0.1.2

1 个答案:

答案 0 :(得分:0)

此时,pwa正在尝试运行pub.exe build。我没有在Windows上尝试过,只有朋友报告它有效,但完全有可能pub.exe不再有效(如果有的话),它应该一直是pub (在这种情况下,它是与Windows相关的错误)。

建议的解决方法:

  • 运行pub build
  • 运行pub run pwa
  • 再次运行pub build

如果上述情况有效,请告诉我,我会在补丁发布中修复它。