-->

Dart app cannot find index.bootstrap.initialize.da

2019-07-06 09:42发布

问题:

I am uncertain why, on attempting to start my app I get the following errors:

debug

GET http://localhost:63342/epimss_polymer_app/web/index.bootstrap.initialize.dart 

pub_serve

Build error:
Transform Reflectable on epimss_polymer_app|ReflectableTransformed threw error: The null object does not have a getter 'type'.

NoSuchMethodError: method not found: 'type'
Receiver: null
Arguments: []
dart:core-patch/object_patch.dart 42                          Object._noSuchMethod
dart:core-patch/object_patch.dart 45                          Object.noSuchMethod
package:reflectable/src/transformer_implementation.dart 2397  _Capabilities._supportsMeta.<fn>
...

Build completed with 1 errors.
[web] GET index.bootstrap.initialize.dart => Could not find asset epimss_polymer_app|web/index.bootstrap.initialize.dart.

pubspec

name: 'epimss_polymer_app'
version: 0.1.0
description: A web app built using polymer.dart.
#author:
#homepage: https://www.example.com

environment:
  sdk: '>=1.9.0 <2.0.0'

dependencies:
  analyzer: 0.27.1
  autonotify_observe: 1.0.0+7

  browser: 0.10.0+2
  bwu_fontawesome_iconset_svg: 0.3.0-3

  epimss_polymer_clerking:
    path: ../epimss_polymer_clerking
  epimss_polymer_reg:
    path: ../epimss_polymer_reg

  polymer: 1.0.0-rc.15
  polymer_elements: 1.0.0-rc.8
  polymer_interop: 1.0.0-rc.8

  quiver_collection: 1.0.0

  shared:
    path: ../../../../dart/shared/shared

  web_components: 0.12.2+2

dependency_overrides:
  reflectable: ^0.5.1

dev_dependencies:
  test: 0.12.6+2

transformers:
- autonotify_observe
- web_components:
    entry_points: web/index.html
- reflectable:
    entry_points: web/index.bootstrap.initialize.dart
- $dart2js:
    $include: '**/*.bootstrap.initialize.dart'
    minify: true
    commandLineOptions:
    - --trust-type-annotations
    - --trust-primitives

I am using the current Dart SDK

回答1:

If you have the newest Polymer version try

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

instead of

transformers:
- autonotify_observe
- web_components:
    entry_points: web/index.html
- reflectable:
    entry_points: web/index.bootstrap.initialize.dart