为什么从Dart Logging_handler包导入browser_logging_handler失败?

时间:2014-10-28 15:15:47

标签: logging dart dart-pub

这是我的pubspec.yaml文件。我有几次跑酒吧。

name: LogTest
description: A sample Polymer application
dependencies:
  logging: any
  logging_handlers: any
  polymer: '>=0.12.0 <0.13.0'
transformers:
- polymer:
    entry_points: web/logtest.html

然而,当我尝试运行我的应用程序时。它失败并显示以下消息:

Failed to load resource: the server responded with a status of 404 (Not Found)   
http://localhost:8081/packages/logging_handlers/browser_logging_handlers.dart An error occurred loading     
file: package:logging_handlers/browser_logging_handlers.dart

我的dart文件(logtest.dart):

import 'package:polymer/polymer.dart'as polymer;
import 'package:logging/logging.dart'; 
import 'package:logging_handlers/browser_logging_handlers.dart';

void main(){
  polymer.initPolymer().run((){
    polymer.Polymer.onReady.then((_){
//      loggie.attachXLoggerUi();
    });
  });
}

和html文件(logtest.html):

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sample app</title>

    <!-- include the web_components polyfills with support for Dart. -->
    <script src="packages/web_components/platform.js"></script>
    <script src="packages/web_components/dart_support.js"></script>

    <!-- import the click-counter -->
    <link rel="import" href="clickcounter.html">

    <link rel="stylesheet" href="logtest.css">
  </head>
  <body>
    <h1>LogTest</h1>

    <p>Hello world from Dart!</p>

    <div id="sample_container_id">
      <click-counter count="5"></click-counter>
    </div>

    <!-- bootstrap polymer -->
    <script type="application/dart" src="logtest.dart"></script>
    <script src="packages/browser/dart.js"></script>
  </body>
</html>

1 个答案:

答案 0 :(得分:1)

看起来pub serve无法识别pubspec.yaml文件或packages目录中的其他链接的更改。 pub serve输出视图有一个停止pub serve的按钮。下次启动应用时,pub serve会自动重新启动。