2017-08-28 33 views
0

我想离线功能添加到一个角镖项目,运行pub buildPWA工人投用AngularDart

错误
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 
+0

你把“pwa.dart”文件放在哪里?您是否检查了示例https://github.com/isoos/pwa/tree/master/examples? –

+0

根据文章,我试图知道如何做到这一点,链接:http://news.dartlang.org/2017/03/making-dart-web-app-offline-capable-3.html –

+0

文章显示添加依赖项会自动生成所需的文件,但它不会,即使在手动添加示例帮助后也会引发相同的错误。 –

回答

0

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

建议的解决办法:

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

如果上面的作品,让我知道,我会在一个补丁修复发布。

+0

是错误仍然存​​在,在运行pub运行pwa –

+0

时,在窗口上运行'pub run pwa'时,错误依然存在于依赖项更新'pwa 0.1.7'中。 –