ufk ufk - 1 year ago 102
Dart Question

package "dart_to_js_script_rewriter" is not a dependency

I just started learning dart.

first I created an angular2-dart based project from https://angular.io/docs/dart/latest/quickstart.html and it worked properly.

now I want to add auth0-lock dart package from https://pub.dartlang.org/packages/auth0_lock, so I modified pubspec.yaml to the following:

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

and now when I execute
pub get
I get the following error:

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

since I'm new to dart and not entirely sure what I'm doing.. I have no idea how to fix this :)

any ideas ?


Answer Source

I get the same error when adding auth0_lock: ^0.1.0 to my dependencies and running pub get. The error message says that "dart_to_js_script_rewriter" is not a dependency in the pubspec.yaml of the auth0_lock package. It looks like it's added under dev_dependecies if you look here. Dev dependencies of any dependent packages are ignored. Pub only gets your package’s dev dependencies.

So I think this is a problem in their package.

So, what I did was I went to https://github.com/andresaraujo/auth0_lock.dart and cloned the package, added it into my own project root in a directory called auth0_lock. And then, in my pubspec.yaml i put:

    path: auth0_lock

After that I can import it using

import 'package:auth0_lock/auth0_lock.dart';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download