【发布时间】:2017-08-28 09:14:55
【问题描述】:
我正在尝试向 angular dart 项目添加离线功能,运行 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
【问题讨论】:
-
你把
pwa.dart文件放在哪里了?你检查过github.com/isoos/pwa/tree/master/examples 的例子吗? -
根据我试图知道如何做到这一点的文章,链接:news.dartlang.org/2017/03/…
-
文章显示添加依赖项会自动生成所需的文件,但它不会,即使在示例的帮助下手动添加后也会抛出相同的错误。
-
github.com/isoos/pwa/tree/master/examples/pwa_defaults 说你需要运行
pub run pwa -
运行 pub run pwa 会抛出同样的错误。
标签: dart service-worker angular-dart dart-pub