简体   繁体   中英

PWA Worker throws an error with AngularDart

I am trying to add offline capabilities to an angular dart project, running pub build but

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

At that point, the pwa is trying to run pub.exe build . I haven't tried it on Windows, only a friend reported it working, but it is entirely possible that pub.exe does no longer work (if it ever did), and it should have been pub all along (and in this case it is a Windows-related bug).

Suggested workaround:

  • run pub build
  • run pub run pwa
  • run pub build again

If the above works, let me know, and I'll fix it in a patch release.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM