6

I recently upgraded angular dart to the recent version [0.13.0]. From then onward it is becoming very difficult just to initialize the application. I have spent around a week fighting with this. I get this error currently:

The built-in library 'dart:html' is not available on the stand-alone VM. 'package:angular/application_factory.dart': error: line 19 pos 1: library handler failed import 'dart:html'; ^

where do I go wrong?

pubspec.yaml

name: abc
description: A sample web application
dependencies:
  angular: "0.13.0"
  browser: any
  http_server: any
  route_hierarchical: any
  web_components: any
transformers:
- angular

main.dart

import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';

import 'package:abc/main_module.dart';

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

main_module.dart

library abc.main_module;

import 'package:angular/angular.dart';
import 'package:abc/formatters/capitalize_filter.dart';
import 'package:abc/components/index_controller.dart';
import 'package:abc/router.dart';

class MainModule extends Module
{
    MainModule()
    {
        bind(CapitalizeFilter);
        bind(IndexController);
        bind(RouteInitializerFn, toValue: MainRouteInitializer);
        bind(NgRoutingUsePushState, toFactory: (_) => new NgRoutingUsePushState.value(false));
    }
}
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Amsakanna
  • 12,254
  • 8
  • 46
  • 58
  • Its seems like Dart SDK is corrupted. try re-installing or update it or make sure that 'dart:html' can be used in other project – youssef Aug 15 '14 at 17:15
  • @youssef: I don't think so. My other test projects with angular versions < 0.10.0 works – Amsakanna Aug 15 '14 at 17:44
  • You could try to run `pub cache repair`. Another issue I connect with your error message is a missing `packages` link. Do you have your entry page in a subdirectory of `web`? What Dart version are you using?. Does `pub upgrade` show any errors? – Günter Zöchbauer Aug 16 '14 at 09:17
  • I'm betting @GünterZöchbauer 's reply will be just what you need, but if not, try removing your http_server dep. – KMDev Aug 23 '14 at 21:32
  • Did you solve this problem? I am getting this when I try to run my dart app unit tests from commandline. The dependecy on dart:html make it impossible to run it in standalone VM, so I need to run my tests in Dartium. Maybe during the update, some library you have used before, started to include it. – MartinTeeVarga Jan 20 '15 at 23:37
  • This problem is not solved yet. I'm using angularjs now. – Amsakanna Jan 26 '15 at 02:57

0 Answers0