有通过代理的pub依赖关系解决方法的解决方法吗? [英] Is there a workaround for pub dependency resolution through proxies?

查看:253
本文介绍了有通过代理的pub依赖关系解决方法的解决方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想玩 https://github.com/dart -lang / web-ui-code-lab 用于dart开发。如果我按照pdf并打开step05,然后尝试运行chat_server.dart,我得到这个错误(我的路径中没有空格,以防万一相关):

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;
^



我假设这意味着有一些缺失的依赖,但我不能运行pub安装,因为我在公司http代理后面:

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.

因此,我开始寻找一个临时解决方法来解决pub依赖。我试图更改pubspec.yaml通过git://协议,而不是http(这将不会解决,而不通过代理):

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

比以前的pub安装,所以我认为它成功地通过了git协议,并试图解决web_ui的依赖,但不幸的是这样做失败web_ui的日志记录的依赖(看起来它仍然通过http://):

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.

看起来我不能改变yaml来使用sdk的日志依赖关系:

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

logging:
    sdk: logging

因为这是与web_ui不兼容的来源:

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'

有没有其他方法来解决这个代理问题与当前的开发工具?我可以镜像pub.dartlang.org不知何故?或镜像每个依赖的git存储库?感谢。

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.

推荐答案

您说您使用的是Mac。如果它是一台笔记本电脑,为什么不尝试从家里做?我会通知酒吧的作者这个问题,看看他是否有任何建议。

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.

这篇关于有通过代理的pub依赖关系解决方法的解决方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆