resolving dependencies with pub get failed - dart

I tried to install the dependencies for the polymer-dart-blog with 'pub get' but unfortunately this operation failed. I have absolutely no idea what the problem is. The ouput looks like this:
C:\Users\fraherm\workspace\polymer-dart-blog>pub get
Resolving dependencies..........................................................
................................................................................
................................................................................
................................................................Error in PubHttp
Client.send (issue 12581) error: HttpException: Connection closed before full he
ader was received, uri = https://pub.dartlang.org/api/packages/unittest/versions
/0.8.10%2B3
stacktrace: #0 PubHttpClient.send (file:///e:/b/build/slave/dart-editor
-win-stable/build/dart/sdk/lib/_internal/pub/lib/src/http.dart:60)
#1 BaseClient._sendUnstreamed.<anonymous closure> (package:http/src/base_cl
ient.dart:118)
#2 _Future._propagateToListeners.<anonymous closure> (dart:async/future_imp
l.dart:453)
#3 _rootRun (dart:async/zone.dart:683)
#4 _RootZone.run (dart:async/zone.dart:823)
#5 _Future._propagateToListeners (dart:async/future_impl.dart:445)
#6 _Future._complete (dart:async/future_impl.dart:303)
#7 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:
354)
#8 _asyncRunCallback (dart:async/schedule_microtask.dart:18)
#9 _createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:11)
#10 _Timer._createTimerHandler._handleTimeout (timer_impl.dart:151)
#11 _Timer._createTimerHandler.<anonymous closure> (timer_impl.dart:166)
#12 _RawReceivePortImpl._handler (dart:isolate-patch/isolate_patch.dart:1)
#13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dar
t:93)
Connection closed before full header was received

Maybe you may just wait a while and then try again as
Seth explains in pub install -> HttpParserException: Connection closed before full header was received
Seems to be a problem with the server.

Related

Intellij Dart Webdev Cannot Find "devtools0.9.7+1/build"

I had no issues at all building my project, I duplicated it to start a new one, still worked then I made some code changes then I randomly can't build it at all. Even the previous project stopped building and I have no idea what the error is. I've tried purging the dart pub cache and everything but it seems this specific error hasn't happened to anyone yet from what I've searched.
Output:
Unhandled exception:
Invalid argument(s): A directory corresponding to fileSystemPath "/Users/chrisl/.pub-cache/hosted/pub.dartlang.org/devtools-0.9.7+1/build" could not be found
#0 createStaticHandler (package:shelf_static/src/static_handler.dart:50:5)
#1 defaultHandler (package:devtools_server/src/external_handlers.dart:40:23)
<asynchronous suspension>
#2 serveDevTools (package:devtools_server/src/server.dart:183:21)
#3 DevTools.start (package:dwds/src/servers/devtools.dart:26:15)
#4 Dwds.start (package:dwds/dwds.dart:132:33)
#5 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:130:25)
#6 ServerManager.start (package:webdev/src/serve/server_manager.dart:23:38)
#7 _startServerManager (package:webdev/src/serve/dev_workflow.dart:103:27)
#8 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:196:31)
<asynchronous suspension>
#9 DaemonCommand.run (package:webdev/src/command/daemon_command.dart:108:29)
<asynchronous suspension>
#10 CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#11 _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
#12 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#13 new Future.sync (dart:async/future.dart:223:31)
#14 CommandRunner.run (package:args/command_runner.dart:112:14)
Build Output

Process.run(): No such file or directory

I don't understand, what am I doing wrong. I install (activate) grinder:
$ pub global activate grinder
Then I create a simple tool/grind.dart:
import "dart:io";
import "package:grinder/grinder.dart";
main(args) => grind(args);
#Task("Build")
build() {
Process.run("webdev build", []);
}
But then Process.run() fails of No such file or directory error:
$ grind build
ProcessException: No such file or directory
Command: webdev build
#0 build (...project/tool/grind.dart:33:3)
<asynchronous suspension>
#1 _LocalLibraryMirror._invoke (dart:mirrors/runtime/libmirrors_impl.dart:1104:36)
#2 _LocalObjectMirror.invoke (dart:mirrors/runtime/libmirrors_impl.dart:230:25)
#3 TaskDiscovery.discoverDeclaration.<anon> (package:grinder/src/discover_tasks.dart:79:38)
#4 _rootRun (dart:async/zone.dart:1124:13)
#5 _CustomZone.run (dart:async/zone.dart:1021:19)
#6 _runZoned (dart:async/zone.dart:1516:10)
#7 runZoned (dart:async/zone.dart:1463:12)
#8 ZonedValue.withValue (package:grinder/src/utils.dart:112:12)
#9 GrinderTask.execute (package:grinder/src/grinder_task.dart:64:27)
#10 Grinder._invokeTask (package:grinder/src/grinder.dart:193:27)
#11 Grinder.start.<anon> (package:grinder/src/grinder.dart:168:16)
#12 Future.forEach.<anon> (dart:async/future.dart:486:26)
#13 Future.doWhile.<anon> (dart:async/future.dart:528:26)
#14 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#15 _RootZone.bindUnaryCallbackGuarded.<anon> (dart:async/zone.dart:1353:26)
#16 Future.doWhile (dart:async/future.dart:543:18)
#17 Future.forEach (dart:async/future.dart:484:12)
#18 Grinder.start (package:grinder/src/grinder.dart:167:21)
#19 runTasks (package:grinder/src/cli.dart:67:39)
<asynchronous suspension>
#20 grind (package:grinder/grinder.dart:46:12)
#21 main (...project/tool/grind.dart:9:15)
Even though webdev build does work correctly (is in path)?:
$ webdev build
Creating build script
...
What is the problem here? How could I fix this? Or is there a way to call webdev build programmatically right from Dart code?
The executable must not contain parameters.
Use instead:
Process.run("webdev", ["build"]);

reflectable 0.3.4 - new version throwing exception

I just updated my dart application and did a pub cache repair afterwards.
The application does not run and debug throws the following exception
Uncaught Unhandled exception:
Unsupported operation: Cannot provide `reflectedType` of instance of generic type 'List'.
#0 InstantiatedGenericClassMirrorImpl.reflectedType (package:reflectable/src/reflectable_transformer_based.dart:713:5)
#1 _getPropertyInfoForType (package:polymer/src/common/polymer_descriptor.dart:210:46)
#2 _buildPropertiesObject.<anonymous closure> (package:polymer/src/common/polymer_descriptor.dart:58:24)
#3 _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:340)
#4 _buildPropertiesObject (package:polymer/src/common/polymer_descriptor.dart:56:16)
#5 createPolymerDescriptor (package:polymer/src/common/polymer_descriptor.dart:26:19)
#6 PolymerRegister.initialize (package:polymer/src/common/polymer_register.dart:19:36)
#7 loadInitializers.<anonymous closure>.<anonymous closure> (package:initialize/src/static_loader.dart:46:32)
#8 _runInitQueue (package:initialize/initialize.dart:35:24)
#9 _runInitQueue.<anonymous closure> (package:initialize/initialize.dart:38:26)
#10 _RootZone.runUnary (dart:async/zone.dart:1149)
#11 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)
#12 _Future._propagateToListeners (dart:async/future_impl.dart:585)
#13 _Future._completeWithValue (dart:async/future_impl.dart:376)
#14 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:430)
#15 _microtaskLoop (dart:async/schedule_microtask.dart:43)
#16 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#17 _ScheduleImmediateHelper._handleMutation (dart:html:49254)
#18 MutationObserver._create.<anonymous closure> (dart:html:27526)
(anonymous function)
The application was running quite well before.
Possible bug?
Thanks
Teddy
Rather long story, please check https://github.com/dart-lang/polymer-dart/issues/651 for some details, and for the resolution of this issue as it unfolds.

Flutter fails on `flutter` command

I'm following the Getting Started with Flutter guide and getting stuck when running the actual flutter command:
flutter init -o my_app
Resolving dependencies...
Error on line 17, column 16 of pubspec.yaml: Invalid version constraint: Could not parse version "^1.4.0". Unknown text at "^1.4.0".
stack_trace: ^1.4.0
^^^^^^
Unhandled exception:
Uncaught Error: FileSystemException: Cannot open file, path = '/Users/craig/Code/flutter/packages/flutter_tools/packages/sky_tools/executable.dart' (OS Error: No such file or directory, errno = 2)
Stack Trace:
#0 _File.open.<anonymous closure> (dart:io/file_impl.dart:349)
#1 _RootZone.runUnary (dart:async/zone.dart:1151)
#2 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#3 _Future._propagateToListeners (dart:async/future_impl.dart:579)
#4 _Future._completeWithValue (dart:async/future_impl.dart:339)
#5 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#6 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#7 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#8 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:883)
#1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
Unhandled exception:
Uncaught Error: FileSystemException: Cannot open file, path = '/Users/craig/Code/flutter/bin/cache/flutter_tools.snapshot' (OS Error: No such file or directory, errno = 2)
Stack Trace:
#0 _File.open.<anonymous closure> (dart:io/file_impl.dart:349)
#1 _RootZone.runUnary (dart:async/zone.dart:1151)
#2 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#3 _Future._propagateToListeners (dart:async/future_impl.dart:579)
#4 _Future._completeWithValue (dart:async/future_impl.dart:339)
#5 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#6 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#7 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#8 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:883)
#1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
Looks like your Dart version is outdated < 1.9.2.
Try dart --version to get the version of your installed Dart SDK.
Current is 1.12.x.
Update 2018-03-20
During the migration phase to Dart 2 you might want to install Dart from the dev channel to get a 2.0.0-alpha.x version.
The newest stable version is 1.24.x
For example
brew install dart --devel
Update 2018-06-21
Now also supported:
brew install dart#2
For others who're facing a similar error, I suggest that you read the docs carefully. I didn't, hence I wasted quite some time looking out for the solution elsewhere, even though it was right in front of my eyes all the time: https://flutter.io/setup-macos/#update-your-path
I'm writing the commands down so that you can copy and paste them easily in your terminal window:
touch $HOME/.bash_profile
open $HOME/.bash_profile
Line 1 creates a text file named .bash_profile. Line 2 opens it.
Then the line given below has to be pasted in the text file:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
Don't forget to save the file after pasting. flutter doctor should work with every Terminal window now.
Open your terminal and run this
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
then run flutter, it will work.
It's because you the path you set up is temporary. To add the path
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
[PATH_TO_FLUTTER_GIT_DIRECTORY] -> Folder where you downloaded flutter or cloned from git.
Then do
echo $PATH
Watch this video to easy install
https://www.youtube.com/watch?v=Em8igImhBKc

html5lib error after update Dart SDK version 0.3.2.0_r17657

When i run the build.dart of my Web Component, the out folder is not created and i receive this error:
SEVERE web/main.html: exception while reading file, original message:
AsyncError: ''package:html5lib/dom.dart': Error: line 91 pos 51: type 'LinkedHashMap' is not loaded
LinkedHashMap<dynamic, String> attributes = new LinkedHashMap();
malformed type used.'
Stack trace:
#0 Node.Node (package:html5lib/dom.dart:91:51)
#1 Document.Document (package:html5lib/dom.dart:313:16)
#2 TreeBuilder.reset (package:html5lib/src/treebuilder.dart:100:16)
#3 TreeBuilder.TreeBuilder (package:html5lib/src/treebuilder.dart:87:10)
#4 HtmlParser.HtmlParser (package:html5lib/parser.dart:148:38)
#5 parseHtml (package:web_ui/src/compiler.dart:34:16)
#6 Compiler._parseHtmlFile.<anonymous closure>.<anonymous closure> (package:web_ui/src/compiler.dart:165:28)
#7 time (package:web_ui/src/utils.dart:38:24)
#8 Compiler._time (package:web_ui/src/compiler.dart:297:16)
#9 Compiler._parseHtmlFile.<anonymous closure> (package:web_ui/src/compiler.dart:164:32)
#10 _ThenFuture._sendValue (dart:async:372:24)
Has anyone the same problem?
Update: thanks for answers. However, i run pub update and now if i run build.dart file the result is:
Uncaught Error: NoSuchMethodError : method not found: 'innerHTML'
Receiver: Instance of 'Element'
Arguments: []
Stack Trace:
#0 Object.noSuchMethod (dart:core-patch:1743:25)
#1 _ElementLoader.visitScriptElement (package:web_ui/src/analyzer.dart:879:16)
#2 _ElementLoader.visitElement (package:web_ui/src/analyzer.dart:770:40)
#3 TreeVisitor.visit (package:html5lib/dom_parsing.dart:208:50)
#4 TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:220:49)
#5 TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:228:48)
#6 TreeVisitor.visitElement (package:html5lib/dom_parsing.dart:237:50)
#7 _ElementLoader.visitElement (package:web_ui/src/analyzer.dart:777:34)
#8 TreeVisitor.visit (package:html5lib/dom_parsing.dart:208:50)
#9 TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:220:49)
#10 TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:228:48)
#11 TreeVisitor.visitElement (package:html5lib/dom_parsing.dart:237:50)
#12 _ElementLoader.visitElement (package:web_ui/src/analyzer.dart:777:34)
#13 TreeVisitor.visit (package:html5lib/dom_parsing.dart:208:50)
#14 TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:220:49)
#15 TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:228:48)
#16 TreeVisitor.visitDocument (package:html5lib/dom_parsing.dart:230:52)
#17 TreeVisitor.visit (package:html5lib/dom_parsing.dart:212:52)
#18 analyzeDefinitions (package:web_ui/src/analyzer.dart:33:15)
#19 Compiler._parseAndDiscover.processHtmlFile.<anonymous closure> (package:web_ui/src/compiler.dart:123:35)
#20 time (package:web_ui/src/utils.dart:38:24)
#21 Compiler._time (package:web_ui/src/compiler.dart:291:16)
#22 Compiler._parseAndDiscover.processHtmlFile (package:web_ui/src /compiler.dart:122:27)
#23 _ThenFuture._sendValue (dart:async:372:24)
I just went through this. It's because the packages you have, haven't been updated. Make sure you are using latest versions of every package, and run pub update.
In my case, I was using an older version of web-ui, which used an older version of html5lib package. I updated web-ui and things worked.
And like Florian said in the other answer, it's caused by a class which has moved to another library.
I recently moved 'LinkedHashMap' from dart:core into dart:collection.
The code you are showing still expects it in core.
Try to find an updated version of the html5lib package (maybe the mailing-list knows where you can download one).
Bob is currently working on versioning the dart-sdk in pub. So hopefully this shouldn't be such a problem in the future.

Resources