2016-07-09 3 views
1

example 다음은이 항목을 실행하지 않으므로 pubspect.yaml에서 약간의 차이점을 제외하고는 상자에서 실행되지 않기 때문입니다. 즉, 예제 링크에 표시된대로 0.1.4 대신 반사가 0.2.0이어야합니다.null 객체에 메서드가 없습니다. [] =

모든 것이 잘 컴파일됩니다. 그러나 런타임 오류가 발생합니다. 나는 다음과 같은 파일에 추적 : 라인 25 일

https://github.com/dart-lang/polymer-dart/blob/behaviors/lib/init.dart

I 얻을 Dartium 브라우저에서 다음과 같은 오류 :

The null object does not have a method '[]='. 

NoSuchMethodError: method not found: '[]=' 
Receiver: null 
Arguments: ["push", Closure: (List, Iterable) => dynamic] 
#0  Object._noSuchMethod (dart:core-patch/object_patch.dart:42) 
#1  Object.noSuchMethod (dart:core-patch/object_patch.dart:45) 
#2  _setUpListMethods (package:polymer/init.dart:25:14) 
#3  initPolymer.<initPolymer_async_body> (package:polymer/init.dart:17:3) 
#4  _RootZone.runUnary (dart:async/zone.dart:1204) 
#5  _FutureListener.handleValue (dart:async/future_impl.dart:131) 
#6  _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637) 
#7  _Future._propagateToListeners (dart:async/future_impl.dart:667) 
#8  _Future._completeWithValue (dart:async/future_impl.dart:477) 
#9  _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528) 
#10  _microtaskLoop (dart:async/schedule_microtask.dart:41) 
#11  _startMicrotaskLoop (dart:async/schedule_microtask.dart:50) 
#12  _ScheduleImmediateHelper._handleMutation (dart:html:49308) 

내 pubspec.yaml

name: myproject 
dependencies: 
    polymer: ^1.0.0-rc 
    web_components: ^0.12.0 
    browser: ^0.10.0 
    reflectable: ^0.2.0 
transformers: 
- reflectable: 
    entry_points: 
    - web/main.dart 
environment: 
    sdk: ">=1.2.0 <2.0.0" 

dependency_overrides: 
    polymer: 
    git: 
     ref: behaviors 
     url: https://github.com/dart-lang/polymer-dart.git 
    polymer_interop: 
    git: 
     ref: 0.2.0-dev 
     url: https://github.com/dart-lang/polymer_interop.git 

pubspec.lock

# Generated by pub 
# See http://pub.dartlang.org/doc/glossary.html#lockfile 
packages: 
    analyzer: 
    description: 
     name: analyzer 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.26.4" 
    args: 
    description: 
     name: args 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.13.4+2" 
    async: 
    description: 
     name: async 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.11.0" 
    barback: 
    description: 
     name: barback 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.15.2+8" 
    boolean_selector: 
    description: 
     name: boolean_selector 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.2" 
    browser: 
    description: 
     name: browser 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.10.0+2" 
    charcode: 
    description: 
     name: charcode 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.1.0" 
    cli_util: 
    description: 
     name: cli_util 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.0.1+2" 
    code_transformers: 
    description: 
     name: code_transformers 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.11" 
    collection: 
    description: 
     name: collection 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.9.0" 
    convert: 
    description: 
     name: convert 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.0.0" 
    crypto: 
    description: 
     name: crypto 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.0.1" 
    csslib: 
    description: 
     name: csslib 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.13.2" 
    dart_style: 
    description: 
     name: dart_style 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.1" 
    glob: 
    description: 
     name: glob 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.1.3" 
    html: 
    description: 
     name: html 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.2+2" 
    http_multi_server: 
    description: 
     name: http_multi_server 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.0.2" 
    http_parser: 
    description: 
     name: http_parser 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "3.0.2" 
    initialize: 
    description: 
     name: initialize 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.6.1+2" 
    logging: 
    description: 
     name: logging 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.11.3" 
    matcher: 
    description: 
     name: matcher 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.0+2" 
    mime: 
    description: 
     name: mime 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.9.3" 
    package_config: 
    description: 
     name: package_config 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.1.5" 
    path: 
    description: 
     name: path 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.3.9" 
    plugin: 
    description: 
     name: plugin 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.1.0" 
    polymer: 
    description: 
     ref: behaviors 
     resolved-ref: "46be7836f387a8a2868507baf61940e871519986" 
     url: "https://github.com/dart-lang/polymer-dart.git" 
    source: git 
    version: "0.17.0-dev" 
    polymer_interop: 
    description: 
     ref: "0.2.0-dev" 
     resolved-ref: cbef534ef5d0839beeeb63f7c25f502df7e79377 
     url: "https://github.com/dart-lang/polymer_interop.git" 
    source: git 
    version: "0.2.0" 
    pool: 
    description: 
     name: pool 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.2.4" 
    pub_semver: 
    description: 
     name: pub_semver 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.3.0" 
    reflectable: 
    description: 
     name: reflectable 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.0" 
    shelf: 
    description: 
     name: shelf 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.6.5+2" 
    shelf_static: 
    description: 
     name: shelf_static 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.4" 
    shelf_web_socket: 
    description: 
     name: shelf_web_socket 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.1" 
    source_map_stack_trace: 
    description: 
     name: source_map_stack_trace 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.4" 
    source_maps: 
    description: 
     name: source_maps 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.10.1+1" 
    source_span: 
    description: 
     name: source_span 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.2.3" 
    stack_trace: 
    description: 
     name: stack_trace 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.6.6" 
    stream_channel: 
    description: 
     name: stream_channel 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.5.0" 
    string_scanner: 
    description: 
     name: string_scanner 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.0" 
    test: 
    description: 
     name: test 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.15+1" 
    typed_data: 
    description: 
     name: typed_data 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.1.3" 
    unittest: 
    description: 
     name: unittest 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.11.6+4" 
    utf: 
    description: 
     name: utf 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.9.0+3" 
    watcher: 
    description: 
     name: watcher 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.9.7+2" 
    web_components: 
    description: 
     name: web_components 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.0+4" 
    web_socket_channel: 
    description: 
     name: web_socket_channel 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.4" 
    when: 
    description: 
     name: when 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.0" 
    which: 
    description: 
     name: which 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.1.3" 
    yaml: 
    description: 
     name: yaml 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.1.10" 
sdk: ">=1.17.0-dev.6.2 <1.20.0" 

그게 내가 가진 것입니다. 다시 말하지만, 다른 모든 파일은 그 예제와 동일합니다.

종속성 문제가있는 것처럼 보이지만 예제를 실행하기 위해 여기에서 어디로 가야할지 모릅니다. 이 오류를 해결할 수 있습니까?

업데이트context 변수 배열이 존재하지 않는 polymer/init.dart 때문에 setUpListMethods()에 실패 할 것 같은데 ... 나는 다트 폴리머는 RC에 여전히 알고 있지만 나는 간단한 예제를 실행할 것이라고 생각할 것입니다. 중단 점을 만들었습니다. 범위 내에서 context을 찾을 수 없습니다. 문맥은 어디에 선언 되었습니까? 그것은 여전히 ​​의존성 문제와 같은 냄새를 풍깁니다. 당신은 최근 고분자 1.0.0-rc.x 버전을 사용하는 경우

+0

가 존재하지 술집 전문가 대신 polymer 변압기를 추가 할 필요가 있지만, 'polymer :^1.0.0-rc'가 어떤 버전 번호를 빠뜨린 것으로 의심됩니다. 적어도 나는 polymer :^1.0.0-rc.17로 달리기를했다. 다른 것들은 프로젝트에서'yaml'을 본다. https://github.com/dart-lang/polymer-dart/blob/master/pubspec.yaml –

+0

내 프로젝트는'dependency_overrides' 없이도 잘 작동하므로 거기에서도 가능합니다. –

+0

@JonasBojesen 좋아, 이제 더 이상 얻을 수있다. 그러나'https : // pub.dartlang.org/packages/custom_element_apigen'을 의존성으로 추가 할 수는 없습니다. 너는 할수 있니? 다음 오류로 내 게시물을 업데이트하겠습니다. – Tek

답변

2

당신은 reflectable 변압기

transformers: 
- polymer: 
    entry_points: 
    - web/index.html 

도 참조 https://github.com/dart-lang/polymer-dart

+0

문제는 제가 Symfony2를 사용하고 있고 다트'web'의 범위에없는'index.html'만의 나뭇 가지 템플릿이 없습니다 폴더. – Tek

+1

폴리머를 사용할 때 변압기가 꼭 필요한 것 같습니다. symfony가 Twig 구문을 사용하기 때문에 Symfony와 같은 프레임 워크를 사용할 수 없다는 것을 의미합니다. Dart 컴파일러는 Dart가 컴파일을 거부 할 때 인식하지 못하는 템플릿을 사용합니다. Twig 구문은 Symfony에서 자산 URL을 관리하는 데 특히 필요합니다.불행한 점은 Symfony와 같은 Dart와 서버 프레임 워크를 사용하는 유일한 방법은 REST API 호출을 사용하는 것입니다. – Tek

관련 문제