3

I'm trying to play with https://github.com/dart-lang/web-ui-code-lab for dart development. If I follow the pdf and open step05, then try to run chat_server.dart, I get this error (my path has no spaces in it, in case that's relevant):

dart --enable-checked-mode bin/chat_server.dart

Unable to open file: path/to/web-ui-code-lab-master/step05/bin/packages/dart_chat/file_logger.dart'file:///path/to/dart/web-ui-code-lab-master/step05/bin/chat_server.dart': Error: line 5 pos 1: library handler failed
import 'package:dart_chat/file_logger.dart' as log;
^

I presume this means that there are some missing dependencies, but I can't run pub install because I'm behind a corporate http proxy:

Running pub install ...
Pub install failed, [1] Resolving dependencies...
Timed out trying to find package "web_ui 0.2.8+6" at http://pub.dartlang.org.

Hence, I started looking for a temporary workaround for pub dependency resolution. I tried changing the pubspec.yaml to go through the git:// protocol instead of http (which won't resolve without going through the proxy):

name: dart_chat
description: This is a chat app written in Dart using the Dart Web UI package

dependencies:
  web_ui:
    git: git://github.com/dart-lang/web-ui.git

I get further than before with pub install, so I think it successfully went through the git protocol and is trying to resolve web_ui's dependencies, but unfortunately doing so fails on web_ui's dependency for logging (which looks like it's still going through http://):

Running pub install ...
Pub install failed, [1] Resolving dependencies...
Timed out trying to find package "logging 0.2.7" at http://pub.dartlang.org.

It looks like I can't change the yaml to use the sdk's logging dependency either:

logging:
    sdk: logging

because that's an incompatible source with web_ui:

Pub install failed, [1] Resolving dependencies...
Incompatible dependencies on 'logging':
- 'dart_chat' depends on it from source 'sdk'
- 'web_ui' depends on it from source 'hosted'

Is there any other way to get around this proxy issue with the current dev tools? Could I mirror pub.dartlang.org somehow? Or mirror the git repositories for each dependency? Thanks.

shindokaku
  • 75
  • 5
  • possible duplicate of [dart pub fail behind a proxy - is there a way to install the packages manually?](http://stackoverflow.com/questions/16808883/dart-pub-fail-behind-a-proxy-is-there-a-way-to-install-the-packages-manually) – Günter Zöchbauer Jul 02 '14 at 13:33

2 Answers2

1

You said that you're using a Mac. If it's a laptop, why don't you try doing it from home? I'll notify the author of pub about this issue to see if he has any suggestions.

Shannon -jj Behrens
  • 4,910
  • 2
  • 19
  • 24
  • There isn't any easy workaround here. I think "install it at home" is probably the easiest fix. Barring that, you could manually download the archive for each package (and its transitive dependencies) and extract them into your packages directory directly, but that's a pain. – munificent Dec 13 '12 at 01:10
  • thanks to both. our team has a mixed environment (desktops/laptops and *nix/win) so we'll need to manually install in the package directory. I did successfully install js-interop and html5lib by hand in dart/dart-sdk/pkg/ on my mac, but trying to install web_ui failed ("entry null is not a supported type"). If this sounds like an issue I should report rather than a problem in my own yaml, please let me know. – shindokaku Dec 13 '12 at 02:07
  • (can't edit the above comment I made, but this is a continuation) installing in step05/packages/ is what I should have been doing (not trying to add to the dart-sdk packages). oops! thanks again. – shindokaku Dec 13 '12 at 14:19
  • If you have a mix of laptops and desktops, then someone with a laptop can install it from outside the firewall, and everyone else can grab a copy from him. Alternatively, you can ssh to a machine outside the firewall (such as an EC2 instance), and do a pub install on that machine. – Shannon -jj Behrens Dec 13 '12 at 21:50
  • The former is probably the option we'll pursue for now, but we've found a couple of hiccups. Even with `.pub-cache/hosted/` populated from an external machine's copy, once inside the firewall `pub install` still tries (and fails) to reach pub.dartlang.org (there's no offline mode for pub yet?). As a result, we are having to manually create our `packages/` links to the `.pub-cache` dependencies within our projects to build and run (without using pub install). Does it sound like we missed a configuration step? Appreciate it! – shindokaku Dec 14 '12 at 18:19
0

Currently there is no way to set a proxy in the Dart Editor, you can star this issue to check when it will be available.

I found a workaround to run the Pub install/update behind a proxy: in Windows, you can acess the "Environment variables" and add a variable named HTTP_PROXY with the value

https://USER:PASSWORD@my.proxy.adress:PORT
Eduardo Copat
  • 4,941
  • 5
  • 23
  • 40
  • Thanks, but unfortunately that doesn't seem to work on the mac binary for pub: `web_ui-0.2.8+6 $ export HTTP_PROXY=http://proxy:port web_ui-0.2.8+6 $ pub install Resolving dependencies... Timed out trying to find package "logging 0.2.7" at http://pub.dartlang.org.` – shindokaku Dec 12 '12 at 22:54
  • 1
    Are you running on Mac then? Try something like this: http://www.webupd8.org/2010/10/how-to-set-proxy-for-terminal-quick.html – Eduardo Copat Dec 12 '12 at 23:21
  • thanks for the followup; it's hard to read without linebreaks but I actually tried this already and pasted the resultant timeout above (fails for both $HTTP_PROXY and $http_proxy), so unfortunately that may be windows-only for the moment – shindokaku Dec 13 '12 at 02:20