简体   繁体   English

dart2js中的代码为get $ functions抛出NoSuchMethodErrors

[英]Code from dart2js is throwing NoSuchMethodErrors for get$functions

My Polymer.dart web app, that works fine in Dartium, is giving the following error (it repeats seven times) when compiled with dart2js using pub build --mode=debug and loaded in Chrome. 我的Polymer.dart网络应用程序在Dartium中运行良好,当使用pub build --mode=debug --mode pub build --mode=debug和dart2js编译并加载到Chrome中时,出现以下错误(重复七次)。

Resource interpreted as Script but transferred with MIME type text/plain: "http://confab.dev/index.html_bootstrap.dart". confab.dev/:10
warning: file:///home/dan/projects/confabulous/webatara/web/index.html.0.dart library not found index.html_bootstrap.dart.js:17188
Uncaught Error: NoSuchMethodError: Cannot call "get$functions" on "#<JsLibraryMirror>" (Object #<JsLibraryMirror> has no method 'get$functions') index.html_bootstrap.dart.js:17188
Stack Trace: 
TypeError: Object #<JsLibraryMirror> has no method 'get$functions'
    at dart._loadLibrary (http://confab.dev/index.html_bootstrap.dart.js:20000:19)
    at dart._loadLibraries (http://confab.dev/index.html_bootstrap.dart.js:19917:11)
    at dart._initPolymerOptimized (http://confab.dev/index.html_bootstrap.dart.js:19908:7)
    at dart.initPolymer (http://confab.dev/index.html_bootstrap.dart.js:19902:7)
    at main (http://confab.dev/index.html_bootstrap.dart.js:4112:7)
    at _IsolateContext.eval$1 (http://confab.dev/index.html_bootstrap.dart.js:1369:23)
    at dart.startRootIsolate (http://confab.dev/index.html_bootstrap.dart.js:1145:21)
    at http://confab.dev/index.html_bootstrap.dart.js:26514:7
    at init.currentScript (http://confab.dev/index.html_bootstrap.dart.js:26494:5)
    at http://confab.dev/index.html_bootstrap.dart.js:26508:3
 index.html_bootstrap.dart.js:17188
Uncaught NoSuchMethodError: Cannot call "get$functions" on "#<JsLibraryMirror>" (Object #<JsLibraryMirror> has no method 'get$functions') index.html_bootstrap.dart.js:2369

Because source maps don't appear to work (they're turned on in Chrome, and I have .map files), I don't even know which part of my code is causing this. 由于源地图似乎无法正常工作(它们已在Chrome中打开,并且我具有.map文件),所以我什至不知道代码的哪一部分导致了此问题。

I've tried with interop.js included both before dart.js, as the docs say , and after, as this issue says. 我已经尝试过将interart.js包含在dart.js之前( 如文档所述) ,然后包括在此问题所述的之后。

Looks like a bug in dart2js. 看起来像dart2js中的错误。 Please file an issue, ideally with a reproducible test-case. 请提出问题,最好使用可复制的测试用例。

pub upgrade fixed it. pub upgrade修复了它。 It turns out that something had replaced the polymer 0.9.5 that I'd been using with 0.8.10+4. 事实证明,有些东西已经用0.8.10 + 4代替了我一直使用的0.9.5聚合物。 Quite odd. 很奇怪。 The solution to this is to set the polymer version as '>= 0.9.5' instead of 'any', which I will do eventually, but for now I'm interested to see if it happens again. 解决方案是将聚合物版本设置为'> = 0.9.5'而不是'any',我最终会这样做,但是现在我很想看看它是否再次发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM