在最新的Polymer Dart版本中使用聚合物JS的core-scaffold时出错

时间:2014-06-03 14:37:55

标签: javascript dart polymer dart-polymer

在听说Polymer JS组件应该开箱即用之后,我开始尝试在我的项目中使用一些Polymer JS元素。

我需要从所有JS组件中删除一些文件,如demo.html,metadata.html和index.html,然后替换为。这样聚合物变压器就不会包含不需要的和不需要的文件,另外还要确保它使用dart polymer.html文件来防止它被加载两次。

我包含了core-scaffold组件,并在最新的Dart编辑器中运行pub serve时出现此错误。


Build error:
Transform ScriptCompactor on gcanvas|web/index.html threw error: The null object does not have a method '>'.

NoSuchMethodError: method not found: '>'
Receiver: null
Arguments: [7]
dart:core-patch/object_patch.dart 45                                            Object.noSuchMethod
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 99:30           Parser._parseBinary
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 71:72           Parser._parsePrecedence
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 43:52           Parser._parseExpression
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 29:28           Parser.parse
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 12:56           parse
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 524:25  _HtmlExtractor._addExpression
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 509:23  _HtmlExtractor._processNormalElement.<fn>
dart:collection-patch/collection_patch.dart 957                                 _HashMap&&_LinkedHashMapMixin.forEach
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 495:28  _HtmlExtractor._processNormalElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 453:43  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 462:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 32:52                 TreeVisitor.visitDocument
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 16:52                 TreeVisitor.visit
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 187:61  _extractUsesOfMirrors
dart:async/zone.dart 730                                                        _rootRunUnary
dart:async/zone.dart 864                                                        _RootZone.runUnary
dart:async/future_impl.dart 488                                                 _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 571                                                 _Future._propagateToListeners
dart:async/future_impl.dart 555                                                 _Future._propagateToListeners.handleWhenCompleteCallback.<fn>
dart:async/zone.dart 730                                                        _rootRunUnary
dart:async/zone.dart 864                                                        _RootZone.runUnary
dart:async/future_impl.dart 488                                                 _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 571                                                 _Future._propagateToListeners
dart:async/future_impl.dart 331                                                 _Future._completeWithValue
dart:async/future_impl.dart 393                                                 _Future._asyncComplete.<fn>
dart:async/schedule_microtask.dart 23                                           _asyncRunCallbackLoop
dart:async/schedule_microtask.dart 32                                           _asyncRunCallback
dart:isolate-patch/isolate_patch.dart 128                                       _RawReceivePortImpl._handleMessage

dart:core                                                                       Object.noSuchMethod
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 99:30           Parser._parseBinary
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 71:72           Parser._parsePrecedence
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 43:52           Parser._parseExpression
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 29:28           Parser.parse
http://127.0.0.1:39312/packages/polymer_expressions/parser.dart 12:56           parse
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 524:25  _HtmlExtractor._addExpression
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 509:23  _HtmlExtractor._processNormalElement.<fn>
dart:collection                                                                 _HashMap&&_LinkedHashMapMixin.forEach
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 495:28  _HtmlExtractor._processNormalElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 453:43  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 462:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 39:50                 TreeVisitor.visitElement
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 465:25  _HtmlExtractor.visitElement
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 12:50                 TreeVisitor.visit
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 24:49                 TreeVisitor.visitChildren
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 30:48                 TreeVisitor.visitNodeFallback
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 32:52                 TreeVisitor.visitDocument
http://127.0.0.1:39312/packages/html5lib/dom_parsing.dart 16:52                 TreeVisitor.visit
http://127.0.0.1:39312/packages/polymer/src/build/script_compactor.dart 187:61  _extractUsesOfMirrors
dart:isolate                                                                    _RawReceivePortImpl._handleMessage
Build completed with 1 errors.
[web] GET /index.html => Could not find asset gcanvas|web/index.html.
[web] GET /favicon.ico => Could not find asset gcanvas|web/favicon.ico.

我将它跟踪到组件core-header-panel,通过排除,然后逐个包括core-scaffold中的组件,直到它再次失败。

有谁知道这种方法在哪里&#39;&gt;&#39;?什么是空的?除非我想放弃使用core-scaffold,否则这是一个阻止者。无论如何粘贴在下面的是bower.json文件和pubspec.yaml的内容,以防它有用。

pubspec.yaml

name: gcanvas
version: 0.0.5
author: James Hurford
description: Canvasing App for doorknocking campaigns.
environment:
  sdk: '>=1.0.0 <2.0.0'
dependencies:
  browser_detect: any
  csvparser: any
  http: any
  http_server: any
  lawndart: any
  mime: any
  polymer: any
  postgresql: any
  route: any
  uuid: any
dev_dependencies:
  scheduled_test: any
transformers:
- polymer:
    entry_points:
    - web/index.html

bower.json

{
  "name": "gcanvas",
  "version": "0.0.0",
  "authors": [
    "James Hurford"
  ],
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "x-tag-imports": "x-tag/x-tag-imports",
    "polymer-ui-tabs": "polymer/polymer-ui-tabs#~0.3.0",
    "core-scaffold": "polymer/core-scaffold#~0.3.1"
  },
  "resolutions": {
    "platform": ">=0.3.0 <1.0.0"
  }
}

由于

1 个答案:

答案 0 :(得分:2)

通过查看引发异常的代码,似乎Polmyer转换器尝试处理HTML文件和绑定表达式。 这看起来像聚合物表达中的错误或缺失特征,并且可能是Dart聚合物变换器。我怀疑这个代码在polymer-header-panel <div id="mainContainer" flex?="{{mode !== 'cover'}}" on-scroll="{{scroll}}"> is causing the exception at the unknown operator !==