2
votes

I've been working with polymer in dart for quite some time now. Recently I went to run a long-running project and had issues with my build.dart file. After having no luck stripping it down to bare bones, I started a new "Sample web application using the polymer library [mobile friendly]" (the default clickcounter example), and before any modifications, I still get the following unhandled exception: build.dart returned error code 255

Unhandled exception:
No top-level getter 'path.Style' declared.

NoSuchMethodError: method not found: 'path.Style'
Receiver: top-level
Arguments: [...]
#0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:168)
#1      systemToAssetPath (package:polymer/src/build/common.dart:219:7)
#2      MappedListIterable.elementAt (dart:_internal/iterable.dart:397)
#3      ListIterable.toList (dart:_internal/iterable.dart:214)
#4      TransformOptions.TransformOptions (package:polymer/src/build/common.dart:101:54)
#5      lint (package:polymer/builder.dart:148:27)
#6      build (package:polymer/builder.dart:122:13)
#7      main (file:///home/dom/Development/dart/click_counter/build.dart:4:8)
#8      _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:212)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:122)

My (unmodified) build.dart file is as follows: import 'package:polymer/builder.dart';

main(args) {
  build(entryPoints: ['web/click_counter.html'],
        options: parseOptions(args));
}

If I try and run it in dartium, I get the following:

Loading polymer/src/build/mirrors_remover, polymer/src/build/delete_file, polymer/src/build/remove_sourcemap_comment, observe and smoke/src/default_transformer transformers...
in ShutdownIsolate: Unhandled exception:
Uncaught Error: 'http://localhost:37071/packages/$pub/serialize/exception.dart': malformed type: line 46 pos 43: type 'Chain' is not loaded
  'stack': stack == null ? null : new Chain.forTrace(stack).toString()
                                      ^
type error.

...

It then hangs on "Loading polymer transformers..."

I encounter a similar issue when running the unmodified "ToDoMVC" example from the welcome page, though the error on run is 'path.prettyUri' NoSuchMethodError.

I've tried it with a number of versions of polymer (0.13.1, 0.13.0+3, 0.12.2+1, 0.12.0+1, 0.10.0). I'm using Dart Editor and SDK 1.6.0.

I'm not a particularly advanced user, so haven't intentionally dug around anywhere scary.

Thanks in advance.

1
You can try pub cache repair maybe some package directory is damaged. - Günter Zöchbauer
And there I was thinking deleting the packages directory and running pub get would do the same thing. This fixed the issue. Interestingly, something in the repaired packages required me to put an 'unresolved' attribute in my body tag. Easy fix - only mentioned it for others who might read this in the future. - DomJack

1 Answers

1
votes

As Günter suggests in the comments, this could be a corrupt package cache.

The reason why deleting the folder doesn't work, is that the packages folders you see are actually just symlinks to a shared central location; so you'd need to follow the links and delete the source folders for this to remove the corruption.