【问题标题】:Dart pub publish gives error after authenticationDart pub publish 在身份验证后给出错误
【发布时间】:2013-01-13 20:23:11
【问题描述】:

我想把一个小的库代码放到 pub.dartlang.org 调用 pub publish 后,它要求我允许访问我的 google 帐户以发送文件。在我通过给定的浏览器链接允许之后,它在命令行中给了我这个错误:

Waiting for your authorization...
Authorization received, processing...
ProcessException: No such file or directory
Command: curl --dump-header /tmp/temp_dir1_CzMqQG/curl-headers --cacert /home/afsina/apps/dart/dart-sdk/util/pub/curl/ca-certificates.crt --request POST --location --max-redirs 5 --data-binary @- --header accept:  --header user-agent:  --header Content-Type: application/x-www-form-urlencoded; charset=UTF-8 --header content-length: 265 https://accounts.google.com/o/oauth2/token

这里是 --verbose 输出

Looks great! Are you ready to upload your package (y/n)? y
IO  : Read line: y
FINE: Loading OAuth2 credentials.
IO  : Seeing if file /home/afsina/.pub-cache/credentials.json exists.
IO  : File /home/afsina/.pub-cache/credentials.json does not exist.
FINE: No credentials found at /home/afsina/.pub-cache/credentials.json.
MSG : Pub needs your authorization to upload packages on your behalf.
    | In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A59097&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
    | Then click "Allow access".
    | 
    | Waiting for your authorization...
MSG : Authorization received, processing...
FINE: Sending Curl request POST https://accounts.google.com/o/oauth2/token
IO  : Begin create temp directory .
IO  : End create temp directory .
IO  : Spawning curl --dump-header /tmp/temp_dir1_RpLNu6/curl-headers --cacert /home/afsina/apps/dart/dart-sdk/util/pub/curl/ca-certificates.crt --request POST --location --max-redirs 5 --data-binary @- --header accept:  --header user-agent:  --header Content-Type: application/x-www-form-urlencoded; charset=UTF-8 --header content-length: 265 https://accounts.google.com/o/oauth2/token
IO  : Spawning curl --dump-header /tmp/temp_dir1_RpLNu6/curl-headers --cacert /home/afsina/apps/dart/dart-sdk/util/pub/curl/ca-certificates.crt --request POST --location --max-redirs 5 --data-binary @- --header accept:  --header user-agent:  --header Content-Type: application/x-www-form-urlencoded; charset=UTF-8 --header content-length: 265 https://accounts.google.com/o/oauth2/token
ERR : ProcessException: No such file or directory
    |   Command: curl --dump-header /tmp/temp_dir1_RpLNu6/curl-headers --cacert /home/afsina/apps/dart/dart-sdk/util/pub/curl/ca-certificates.crt --request POST --location --max-redirs 5 --data-binary @- --header accept:  --header user-agent:  --header Content-Type: application/x-www-form-urlencoded; charset=UTF-8 --header content-length: 265 https://accounts.google.com/o/oauth2/token

我猜它找不到 ca-certificates.crt 文件,但不确定原因。

版本信息:Dart SDK 版本 0.2.10.1_r16761 ubuntu linux 12.10 64位

【问题讨论】:

  • 显然 ca-certificates.crt 文件在那里。所以这不是原因。

标签: dart dart-pub


【解决方案1】:

我的错,这是因为 pub 具有“curl”依赖项。安装 curl 后,我可以发布库。

【讨论】:

  • 实际上 curl 二进制文件包含在 sdk/util/pub 目录中。而且似乎我不需要单独安装它。可能出现这个错误是因为我从项目根目录调用 pub 命令。
【解决方案2】:

如果您在 Linux 或 Mac 上运行 pub,它将假定 curl 在您的 PATH 中并尝试在没有明确路径的情况下生成它。在 Windows 上,它将使用包含的 curl 二进制文件。我们在这里的假设是大多数 *NIX 用户已经安装了 curl。

无论如何,这种 curl 依赖性应该很快就会消失,但我很高兴你找到了解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-21
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多