包“dart_to_js_script_rewriter”不是依赖项

时间:2016-07-24 04:04:22

标签: dart auth0

我刚开始学习飞镖。

首先我从https://angular.io/docs/dart/latest/quickstart.html创建了一个基于angular2-dart的项目,它运行正常。

现在我想从https://pub.dartlang.org/packages/auth0_lock添加auth0-lock dart包,所以我将pubspec.yaml修改为以下内容:

name: go_dart_angular2_zingchart
description: Go Dart Angular2 with ZingChart Started Kit
version: 0.0.1
environment:
  sdk: '>=1.13.0 <2.0.0'
dependencies:
  angular2: ^2.0.0-beta.18
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1
  auth0_lock: ^0.1.0
transformers:
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: client/web/main.dart
- dart_to_js_script_rewriter

现在当我执行pub get时,我收到以下错误:

Error on line 15, column 3 of ../../../.pub-cache/hosted/pub.dartlang.org/auth0_lock-0.1.0/pubspec.yaml: Error loading transformer "dart_to_js_script_rewriter": package "dart_to_js_script_rewriter" is not a dependency.
- dart_to_js_script_rewriter
  ^^^^^^^^^^^^^^^^^^^^^^^^^^

因为我刚接触飞镖并且不完全确定我在做什么......我不知道如何解决这个问题:)

任何想法?

谢谢!

1 个答案:

答案 0 :(得分:2)

auth0_lock: ^0.1.0添加到我的依赖项并运行pub get时出现同样的错误。错误消息显示&#34; dart_to_js_script_rewriter&#34;不是auth0_lock包的pubspec.yaml中的依赖项。如果你看here,它似乎已在dev_dependecies下添加了。任何依赖包的Dev dependencies都将被忽略。 Pub仅获取您的包的dev依赖项。

所以我认为这是他们包中的一个问题。

所以,我做的是我去了https://github.com/andresaraujo/auth0_lock.dart并克隆了包,将它添加到我自己的项目根目录中,名为auth0_lock。然后,在我的pubspec.yaml中,我把:

auth0_lock:
    path: auth0_lock

之后我可以使用

导入它
import 'package:auth0_lock/auth0_lock.dart';