2016-07-24 60 views
0

我刚开始学习飞镖。包“dart_to_js_script_rewriter”不是依赖关系

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

现在我想从https://pub.dartlang.org/packages/auth0_lock添加auth0锁镖包,让我修改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 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^ 

,因为我是新来的DART和不完全知道我在做什么。我不知道如何解决这一问题:)

什么想法?

谢谢!

回答

2

auth0_lock: ^0.1.0添加到我的依赖关系并运行pub get时,出现同样的错误。该错误消息表明“dart_to_js_script_rewriter”不是auth0_lock包的pubspec.yaml中的依赖项。它看起来像是在dev_dependecies下添加的,如果你看起来here。任何相关软件包的Dev dependencies被忽略。 Pub仅获得您的软件包的开发依赖关系。

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

因此,我所做的是我去了https://github.com/andresaraujo/auth0_lock.dart并克隆了该软件包,并将其添加到我自己的项目根目录下的一个名为auth0_lock的目录中。然后,在我的pubspec.yaml我把:

auth0_lock: 
    path: auth0_lock 

在那之后我可以用

import 'package:auth0_lock/auth0_lock.dart'; 
+1

请参阅导入也https://github.com/dart-lang/pub/issues/1259 。这是'pub'的限制。讨论了支持变换器的'dev_transformers'只在程序包本身构建时才运行的程序包,而不是构建为另一个程序包的依赖项。该变换器仅在'auth0_lock'中用作示例,在作为依赖项使用时不相关。 –