Module.DEFAULT_REFLECTOR未初始化(Module.DEFAULT_REFLEC

2019-10-21 06:08发布

我设置了一个AngularDart / PolymerDart项目,但我一直对以下错误运行:

Breaking on exception: Module.DEFAULT_REFLECTOR not initialized for dependency injection. http://goo.gl/XFXx9G

现在,我已经在读错误的最终给出的URL后面的页面,并做了一些Stackoverflowing,但我碰到的唯一sollution被添加-angular作为pubspect.yaml变压器。 我就这样做。 但我还是继续得到同样的错误,我的项目将无法启动。

我pubspec.yaml:

name: application
description: application
dependencies:
  angular: '>=1.0.0 <2.0.0'
  angular_node_bind: any
  core_elements: '>=0.3.2 <0.5.0'
  paper_elements: '>=0.5.0 <0.6.0'
  polymer: '>=0.14.0 <0.16.0'
  web_components: '>=0.9.0 <0.10.0'
dependency_overrides:
  args: '>=0.10.0 <0.12.0'
  code_transformers: '>=0.1.4+2 <0.3.0'
  html5lib: '>=0.10.0 <0.13.0'
  observe: '>=0.11.0 <0.13.0'
transformers:
- angular
- polymer:
    entry_points:
    - client/web/index.html

index.html的:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Application</title>

    <!-- include the web_components polyfills with support for Dart. -->
    <script src="../packages/web_components/platform.js"></script>

    <!-- imports -->
    <link rel="import" href="../packages/polymer/polymer.html">
    <link rel="import" href="components/component.html">

  </head>
  <body>

    <!--
      don't put ng-app on html or body. the polymer build inlines
      custom elements definitions, which can trigger bugs if the code
      inlined is inside of ng-app
     -->
    <div ng-app>      
      <section>
        <p>Angular</p>
        <p>
          <input type="text" ng-model="cool"> Angular binding: {{cool}}
        </p>
      </section>

      <section>
        <p>Polymer</p>
        <my-element message="[[ cool ]]"></my-element>
      </section>
    </div>

    <!-- initialize -->
    <script type="application/dart" src='dart/init.dart'></script>
    <script src="../packages/browser/dart.js"></script>

  </body>
</html>

init.dart:

import 'package:polymer/polymer.dart';
import 'package:angular/application_factory.dart';
import 'package:angular_node_bind/angular_node_bind.dart' show NodeBindModule;

void main() {
  initPolymer()
    .run(() {
     applicationFactory()
       .addModule(new NodeBindModule())
       .run();
    });

}

Answer 1:

看来,“网络”文件夹必须在同一文件夹作为pubspec.yaml。 我把Web文件夹的文件夹“客户端”,这引起了问题里面。 把网络文件夹中的项目的根文件夹再次固定的问题。



文章来源: Module.DEFAULT_REFLECTOR not initialized