1

我正在使用 Dart 0.8.10_r30104 (DEV) 并发现它无法生成 Javascript(尽管应用程序本身可以在 Dartium 中运行)。

当我在 builder.dart 上选择“生成 Javascript”时提示错误:

--- Nov 12, 2013 7:35:43 AM Running dart2js... ---
F:\dart\dart-sdk\bin\dart2js.bat --out=E:\My Books\Sitepoint\Sample\build.dart.js E:\My Books\Sitepoint\Sample\build.dart
/E:/My Books/Sitepoint/Sample/packages/polymer/builder.dart:83:8: Error: Library not found 'dart:io'.
import 'dart:io';
   ^^^^^^^^^
/E:/My Books/Sitepoint/Sample/packages/polymer/src/build/linter.dart:11:8: Error: Library not found 'dart:io'.
import 'dart:io';
   ^^^^^^^^^
/E:/My Books/Sitepoint/Sample/packages/barback/src/asset.dart:9:8: Error: Library not    found 'dart:io'.
import 'dart:io';
   ^^^^^^^^^
...
/E:/My Books/Sitepoint/Sample/packages/analyzer/src/generated/element.dart:7220:17: Hint: The class 'VoidTypeImpl' overrides 'operator==', but not 'get hashCode'.
   bool operator ==(Object object) => identical(object, this);
            ^^
/E:/My Books/Sitepoint/Sample/packages/analyzer/src/generated/element.dart:4874:17:     Hint: The class 'PropertyAccessorElementImpl' overrides 'operator==', but not 'get hashCode'.
  bool operator ==(Object object) => super == object && identical(isGetter, ((object as PropertyAccessorElement)).isGetter);
            ^^
Error: Compilation failed.

===

什么地方出了错?

4

1 回答 1

1

要为聚合物应用程序生成 JS,您需要在应用程序的顶层运行“pub build”。这将创建一个名为 build 的顶级目录,其中将包含您的 JS(以及指向 JS 的 html)。

于 2013-11-12T14:02:05.923 回答