【问题标题】:Unable to start ember-cli project because of git error由于 git 错误,无法启动 ember-cli 项目
【发布时间】:2014-10-28 10:48:05
【问题描述】:

当我尝试执行 ember new myproject 时,我得到以下信息:

[ ... snip ...]
  create vendor/.gitkeep
Installed packages for tooling via npm.
Failed to execute "git ls-remote --tags --heads git://github.com/stefanpenner/ember-load-initializers.git", exit code of #128
Error: Failed to execute "git ls-remote --tags --heads git://github.com/stefanpenner/ember-load-initializers.git"
 exit code of #128
    at createError (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/util/createError.js:4:15)
    [ ... snip ...]

所以我尝试执行失败的命令:

$ git ls-remote --tags --heads git://github.com/stefanpenner/ember-load-initializers.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.131]: errno=Operation timed out

git://github.com 语法对我来说是新的,所以我尝试了一个更熟悉的版本git@github.com:

$ git ls-remote --tags --heads git@github.com:stefanpenner/ember-load-initializers.git                                                                                        
3a6dc87e29efc9de4bc42b6f9afedabb000bcc89        refs/heads/master
be13fa4a45abff2c9fcfc82497668ed2a925a856        refs/tags/0.0.1
3a6dc87e29efc9de4bc42b6f9afedabb000bcc89        refs/tags/v0.0.2
$

谁能帮我诊断这个问题?我很乐意使用git solutionor anember` 解决方法。

编辑:

我试过了:

$ ember new myproject --skip-git

结果相同。我也试过了

$ ember new myproject --skip-bower

这似乎竞争成功,但随后在$ ember serve 上报错,抱怨缺少凉亭组件。

如果我再尝试:

$ bower install

然后我遇到了同样的git:// 问题。所以我想这真的是一个凉亭/ git问题。仍然感谢您的建议。

【问题讨论】:

    标签: git ember.js bower ember-cli


    【解决方案1】:

    这往往是防火墙的问题。验证您的防火墙是否允许您进入git:// 域。当我运行命令时,我得到了

    $ git ls-remote --tags --heads git://github.com/stefanpenner/ember-load-initializers.git
    3a6dc87e29efc9de4bc42b6f9afedabb000bcc89        refs/heads/master
    be13fa4a45abff2c9fcfc82497668ed2a925a856        refs/tags/0.0.1
    3a6dc87e29efc9de4bc42b6f9afedabb000bcc89        refs/tags/v0.0.2
    

    【讨论】:

    • 我猜你可能会说我已经验证我无法访问 git://。问题是:该怎么办?
    • 这通常是防火墙问题。如果你在一个有办公室的办公室里,你可能需要打开它。这来自 ember 在 package.json 中直接使用来自 github 的依赖项
    • 您可以通过此评论修复:github.com/stefanpenner/ember-cli/issues/…
    • 好建议。我退出了我的公司 VPN,它现在可以工作了。这是一个个人项目,我是出于习惯进入 VPN,所以这对我来说是一个足够好的解决方案,尽管您链接到的问题看起来是一个更好的解决方案。
    【解决方案2】:

    我遇到了同样的问题,并通过将空代理设置显式添加到 .bowerrc 解决了它

    $ ember new myproject --skip-bower
    

    然后我将项目中的.bowerrc 编辑为如下所示:

    {
      "directory": "bower_components",
      "analytics": false,
      "proxy":"",
      "https-proxy":""
    }
    

    最后做了一个

    $ bower install
    

    当时效果很好。

    【讨论】:

      【解决方案3】:

      检查一下: git:// protocol blocked by company, how can I get around that?

      所以,回答你的问题:

       $ git ls-remote --tags --heads git://github.com/stefanpenner/ember-load-initializers.git
       ...Connection timed out
       $ git config --global url."https://".insteadOf git://
       $ git ls-remote --tags --heads git://github.com/stefanpenner/ember-load-initializers.git
      2ac2abfa69f9ea682a7461fd6c46a96a56c276fd    refs/heads/master
      be13fa4a45abff2c9fcfc82497668ed2a925a856    refs/tags/0.0.1
      3a6dc87e29efc9de4bc42b6f9afedabb000bcc89    refs/tags/v0.0.2
      

      有人可能会争辩说,打开到端口 TCP 9148 的传出连接会是更好的解决方案,但事实就是如此。不是那个被称为ServerFault的流氓国家

      (我小子:https://serverfault.com/questions/189070/what-firewall-ports-need-to-be-open-to-allow-access-to-external-git-repositories

      【讨论】:

      • 感谢您的提问。我的工作计算机现在将在不打开端口 TCP 9418 的情况下处理“git://”地址
      【解决方案4】:

      如果您遇到问题,请使用 --skip-git 参数,并在以后手动处理版本控制。

      另见:$ ember help new

      【讨论】:

      • --skip-git 没有改变任何东西,看起来它只是阻止了 ember 创建本地 git repo。
      猜你喜欢
      • 2014-08-10
      • 2018-06-12
      • 1970-01-01
      • 2013-08-16
      • 1970-01-01
      • 1970-01-01
      • 2018-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多