2

Edit: I did the experiment all over again (and updated to polymer 0.12) and it turns out that now I'm only I'm getting the "Uncaught Strict get failed, invalid object." error at startup coming from platform.js - and actually the app works if I just resume the execution at this point via pressing F8 in DartEditor. The question is now misleading, that's why I'm adding this comment at the top. My main app is still not working and gives me the "method not found" error, but this is another story. I am leaving the original message below for historical reasons.

If you create a dummy application using the polymer template, it starts fine, but once you move the clickcounter to another directory, you will start getting "NoSuchMethodError: method not found: 'whenPolymerReady'" error. I have updated references accordingly and the new folder structure looks like that:

/lib
  /src
    /test
       clickcounter.dart
       clickcounter.html
/web
  polytest.html 

This is how the modified line in the polytest.html looks:

<link rel="import" href="../lib/src/test/clickcounter.html">

This folder structure was working perfectly in Dart 1.4, but I couldn't get it to work since the upgrade to 1.5. I am using polymer v0.12.

I wonder if I'm doing it wrong and the folder structure should be different? Is there a "blessed" way of structuring your folders with polymer?

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Andrew Skalkin
  • 287
  • 3
  • 10
  • Your import is still wrong. You shouldn't go through lib but through packages and this way there is no lib. – Günter Zöchbauer Jul 31 '14 at 15:29
  • 1
    I added my comment after I read your edit ;-) Even if it works, your import through `lib` calls for troubles. If your question is no longer relevant its better to delete it. When you know more details you can 'undelete' it after you have refined it. – Günter Zöchbauer Jul 31 '14 at 15:33
  • Thanks for your suggestions! I am trying to make the structure right :) Your import line did not work for me so far - I tried prepending the path with "../" or modifying to add lib, however it still can't find it. What puzzles me is that it is looking for "src|lib/test/clickcounter.html.", while I would expect it to look for something with "src/test" in the middle. Build error: Transform ImportInliner on polyTest|web/polytest.html threw error: Could not find asset src|lib/test/clickcounter.html. null null – Andrew Skalkin Jul 31 '14 at 15:49
  • 1
    The path in the error message is indeed weird. `pub serve` usually shows a warning and the correct import path at the top of its output (in the `Tools Output` view) when it finds an invalid one, but the message usually scrolls out of sight very fast (need to scroll up). – Günter Zöchbauer Jul 31 '14 at 15:53
  • Thank you! Your suggestion to reference it through /packages really helped. Once I figured out how to provide the proper path (omitting the 'lib' folder) and changed it everywhere, my real application started working, too. You saved my day! :) – Andrew Skalkin Jul 31 '14 at 21:01
  • possible duplicate of [Exception: NoSuchMethodError: method not found: 'whenPolymerReady'](http://stackoverflow.com/questions/24644438/exception-nosuchmethoderror-method-not-found-whenpolymerready) – pjv Aug 07 '14 at 21:26

1 Answers1

2
<link rel="import" href="../packages/src/test/clickcounter.html">

If it doesn't work prepend another ../ (I'm never absolutely sure how far up is necessary - but I think it is one level above of your_package directory even when it's counter-intuitive)
but pub serve or pub build print a correct suggestion of the entire path if the number of ../ is not correct.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Thank you for your comment! It turns out that the dummy app works the way I described it in the first message (see the edit I've just made), I apologize for confusion. Still trying to convert my main app... it would be great if polymer provided some sort of diagnostics as to what went wrong. – Andrew Skalkin Jul 31 '14 at 15:31